projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e81231e
)
sd-bus: initialize mutex after we allocated the wqueue
author
Lennart Poettering
<lennart@poettering.net>
Thu, 17 Jan 2019 20:06:30 +0000
(21:06 +0100)
committer
Lukas Nykryn
<lnykryn@redhat.com>
Mon, 3 Feb 2020 10:05:28 +0000
(11:05 +0100)
That way the mutex doesn't have to be destroyed when we exit early due
to OOM.
(cherry picked from commit
2fe9a10d7695c4c3a748969a0d1662c624e50e5e
)
Related: CVE-2020-1712
src/libsystemd/sd-bus/sd-bus.c
patch
|
blob
|
history
diff --git
a/src/libsystemd/sd-bus/sd-bus.c
b/src/libsystemd/sd-bus/sd-bus.c
index 01060d105c1b0cfb372eb6413b5f572cf035ebea..e49d58137dfceb9756153620b12f03e7bda1fbeb 100644
(file)
--- a/
src/libsystemd/sd-bus/sd-bus.c
+++ b/
src/libsystemd/sd-bus/sd-bus.c
@@
-248,12
+248,12
@@
_public_ int sd_bus_new(sd_bus **ret) {
b->original_pid = getpid_cached();
b->n_groups = (size_t) -1;
- assert_se(pthread_mutex_init(&b->memfd_cache_mutex, NULL) == 0);
-
/* We guarantee that wqueue always has space for at least one entry */
if (!GREEDY_REALLOC(b->wqueue, b->wqueue_allocated, 1))
return -ENOMEM;
+ assert_se(pthread_mutex_init(&b->memfd_cache_mutex, NULL) == 0);
+
*ret = TAKE_PTR(b);
return 0;
}