Commit 67ee56fc authored by Michael Biebl's avatar Michael Biebl

Fix prepare priority queue comparison function in sd-event

Otherwise a disabled event source can get swapped with an enabled one
and cause a severe sd-event malfunction, breaking the event loop.

Closes: #789796
parent e83b0f94
......@@ -4,6 +4,10 @@ systemd (215-17+deb8u5) UNRELEASED; urgency=medium
services are properly killed after a given timeout. (Closes: #813702)
* Don't reset log level to NOTICE if we get quiet on the kernel cmdline.
(Closes: #828006)
* Fix prepare priority queue comparison function in sd-event.
Otherwise a disabled event source can get swapped with an enabled one
and cause a severe sd-event malfunction, breaking the event loop.
(Closes: #789796)
-- Michael Biebl <biebl@debian.org> Fri, 01 Jul 2016 17:35:05 +0200
......
From: Krzysztof Kotlenga <k.kotlenga@sims.pl>
Date: Thu, 24 Sep 2015 00:34:51 +0200
Subject: sd-event: fix prepare priority queue comparison function
Otherwise a disabled event source can get swapped with an enabled one
and cause a severe sd-event malfunction.
http://lists.freedesktop.org/archives/systemd-devel/2015-September/034356.html
(cherry-picked from commit 8046c4576a68977a1089d2585866bfab8152661b)
---
src/libsystemd/sd-event/sd-event.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index ecab8f0..fd17439 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -228,6 +228,12 @@ static int prepare_prioq_compare(const void *a, const void *b) {
assert(x->prepare);
assert(y->prepare);
+ /* Enabled ones first */
+ if (x->enabled != SD_EVENT_OFF && y->enabled == SD_EVENT_OFF)
+ return -1;
+ if (x->enabled == SD_EVENT_OFF && y->enabled != SD_EVENT_OFF)
+ return 1;
+
/* Move most recently prepared ones last, so that we can stop
* preparing as soon as we hit one that has already been
* prepared in the current iteration */
@@ -236,12 +242,6 @@ static int prepare_prioq_compare(const void *a, const void *b) {
if (x->prepare_iteration > y->prepare_iteration)
return 1;
- /* Enabled ones first */
- if (x->enabled != SD_EVENT_OFF && y->enabled == SD_EVENT_OFF)
- return -1;
- if (x->enabled == SD_EVENT_OFF && y->enabled != SD_EVENT_OFF)
- return 1;
-
/* Lower priority values first */
if (x->priority < y->priority)
return -1;
......@@ -160,6 +160,7 @@ make-sure-all-swap-units-are-ordered-before-the-swap-targ.patch
nspawn-fix-network-interface.patch
service-use-the-right-timeout-for-stop-processes-we-fork.patch
core-don-t-reset-log-level-to-NOTICE-if-we-get-quiet-on-t.patch
sd-event-fix-prepare-priority-queue-comparison-function.patch
## Debian specific patches:
Add-back-support-for-Debian-specific-config-files.patch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment