Skip to content

Commit d13489e

Browse files
fbuihuumartinpitt
authored andcommitted
core: make sure to not call device_is_bound_by_mounts() when dev is null (systemd#5033)
device_setup_unit() might be called (when an event happened in /proc/self/mountinfo for example) with a null 'dev' parameter. This indicates that the device has been unplugged but the corresponding mountpoint is still visible in /proc/self/mountinfo. This patch makes sure we don't call device_is_bound_by_mounts() in this case. Fixes: systemd#5025
1 parent 91b8fd3 commit d13489e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa
385385
* on its radar. In this case the device unit is partially initialized
386386
* and includes the deps on the mount unit but at that time the "bind
387387
* mounts" flag wasn't not present. Fix this up now. */
388-
if (device_is_bound_by_mounts(u, dev))
388+
if (dev && device_is_bound_by_mounts(u, dev))
389389
device_upgrade_mount_deps(u);
390390

391391
/* Note that this won't dispatch the load queue, the caller

0 commit comments

Comments
 (0)