mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
udevd: don't use monitor after manager_exit()
If udevd receives an exit signal, it releases its reference on the udev monitor in manager_exit(). If at this time a worker is hanging, and if the event timeout for this worker expires before udevd exits, udevd crashes in on_sigchld()->udev_monitor_send_device(), because the monitor has already been freed. Fix this by testing the validity of manager->monitor in on_sigchld().
This commit is contained in:
parent
3cabdc2345
commit
030f457167
@ -1311,10 +1311,12 @@ static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, voi
|
||||
device_delete_db(worker->event->dev);
|
||||
device_tag_index(worker->event->dev, NULL, false);
|
||||
|
||||
/* forward kernel event without amending it */
|
||||
r = device_monitor_send_device(manager->monitor, NULL, worker->event->dev_kernel);
|
||||
if (r < 0)
|
||||
log_device_error_errno(worker->event->dev_kernel, r, "Failed to send back device to kernel: %m");
|
||||
if (manager->monitor) {
|
||||
/* forward kernel event without amending it */
|
||||
r = device_monitor_send_device(manager->monitor, NULL, worker->event->dev_kernel);
|
||||
if (r < 0)
|
||||
log_device_error_errno(worker->event->dev_kernel, r, "Failed to send back device to kernel: %m");
|
||||
}
|
||||
}
|
||||
|
||||
worker_free(worker);
|
||||
|
Loading…
Reference in New Issue
Block a user