diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-03-08 11:37:17 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-03-08 11:59:09 +0100 |
commit | cf5366387b24633284ee92285ea64a282270d591 (patch) | |
tree | a4753dc7bf319a16ed8d9d6fdee4ae09b2669279 /src/home/homed-manager-bus.c | |
parent | homed: wrap some very long lines (diff) | |
download | systemd-cf5366387b24633284ee92285ea64a282270d591.tar.xz systemd-cf5366387b24633284ee92285ea64a282270d591.zip |
homed: disable event sources before unreffing them
C.f. 9793530228.
We'd crash when trying to access an already-deallocated object:
Thread no. 1 (7 frames)
#2 log_assert_failed_realm at ../src/basic/log.c:844
#3 event_inotify_data_drop at ../src/libsystemd/sd-event/sd-event.c:3035
#4 source_dispatch at ../src/libsystemd/sd-event/sd-event.c:3250
#5 sd_event_dispatch at ../src/libsystemd/sd-event/sd-event.c:3631
#6 sd_event_run at ../src/libsystemd/sd-event/sd-event.c:3689
#7 sd_event_loop at ../src/libsystemd/sd-event/sd-event.c:3711
#8 run at ../src/home/homed.c:47
The source in question is an inotify source, and the messages are:
systemd-homed[1340]: /home/ moved or renamed, recreating watch and rescanning.
systemd-homed[1340]: Assertion '*_head == _item' failed at src/libsystemd/sd-event/sd-event.c:3035, function event_inotify_data_drop(). Aborting.
on_home_inotify() got called, then manager_watch_home(), which unrefs the
existing inotify_event_source. I assume that the source gets dispatched again
because it was still in the pending queue.
I can't reproduce the issue (timing?), but this should
fix #17824, https://bugzilla.redhat.com/show_bug.cgi?id=1899264.
Diffstat (limited to 'src/home/homed-manager-bus.c')
-rw-r--r-- | src/home/homed-manager-bus.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/home/homed-manager-bus.c b/src/home/homed-manager-bus.c index d3ac98f901..8a06bb62bf 100644 --- a/src/home/homed-manager-bus.c +++ b/src/home/homed-manager-bus.c @@ -860,7 +860,7 @@ static int on_deferred_auto_login(sd_event_source *s, void *userdata) { assert(m); - m->deferred_auto_login_event_source = sd_event_source_unref(m->deferred_auto_login_event_source); + m->deferred_auto_login_event_source = sd_event_source_disable_unref(m->deferred_auto_login_event_source); r = sd_bus_emit_properties_changed( m->bus, |