[systemd-devel] [PATCH] udev: Do not try to start worker if it cannot not recieve events

philippedeswert at gmail.com philippedeswert at gmail.com
Tue Nov 18 03:17:11 PST 2014


From: Philippe De Swert <philippe.deswert at jollamobile.com>

udev_monitor_enable_receiving() enables a udev_monitor to recieve
events. If this fails, the worker here created most likely won't
recieve any events and will probably not be very useful. So now
we check if the event recieving is activated before creating the
new worker.

Found with Coverity: CID#996477
---
 src/udev/udevd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 3c3de76..d46ddcc 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -183,7 +183,8 @@ static void worker_new(struct event *event) {
                 return;
         /* allow the main daemon netlink address to send devices to the worker */
         udev_monitor_allow_unicast_sender(worker_monitor, monitor);
-        udev_monitor_enable_receiving(worker_monitor);
+        if(!udev_monitor_enable_receiving(worker_monitor))
+                return;
 
         worker = new0(struct worker, 1);
         if (worker == NULL) {
-- 
1.8.3.2



More information about the systemd-devel mailing list