From a073cfa844e04010a2695f309b273c906ada271a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Jul 2009 14:13:20 +0200 Subject: [PATCH] udevd: detach event from worker if we kill a worker Jul 8 09:36:41 udevd[663]: worker [5491] did not accept message, kill it Jul 8 09:36:41 udevd[663]: worker [5491] unexpectedly returned with 0 Jul 8 09:36:41 udevd[663]: worker [5551] unexpectedly returned with 0 Jul 8 09:36:41 kernel: [ 156.832086] <6>udevd[663]: segfault at 4 ip 00959fbc sp bfbe7b78 error 6 in udevd[94f000+1c000] https://bugs.launchpad.net/ubuntu/+source/udev/+bug/396957 --- udev/udevd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index b2e4a022..cfb8823f 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -328,8 +328,9 @@ static void event_run(struct event *event) event->state = EVENT_RUNNING; count = udev_monitor_send_device(monitor, worker->monitor, event->dev); if (count < 0) { - err(event->udev, "worker [%u] did not accept message, kill it\n", worker->pid); event->state = EVENT_QUEUED; + worker->event = NULL; + err(event->udev, "worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count); worker->state = WORKER_KILLED; kill(worker->pid, SIGKILL); continue; @@ -521,6 +522,9 @@ static void worker_returned(void) if (worker->pid != msg.pid) continue; + if (worker->state != WORKER_RUNNING) + break; + /* worker returned */ worker->event->exitcode = msg.exitcode; event_queue_delete(worker->event); -- 2.39.5