projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f053fc3
)
sd-device: don't accept /sys as a device path
author
Lubomir Rintel
<lkundrak@v3.sk>
Mon, 24 Jun 2019 18:38:30 +0000
(20:38 +0200)
committer
Yu Watanabe
<watanabe.yu+github@gmail.com>
Tue, 25 Jun 2019 01:22:18 +0000
(10:22 +0900)
Because it's not a device path and (slightly) bad things happen if it
gets confused with one:
$ udevadm info /sys/
Assertion 'device->devpath[0] == '/'' failed at
../src/libsystemd/sd-device/sd-device.c:958,
function sd_device_get_devpath(). Aborting.
Aborted (core dumped)
src/libsystemd/sd-device/sd-device.c
patch
|
blob
|
history
diff --git
a/src/libsystemd/sd-device/sd-device.c
b/src/libsystemd/sd-device/sd-device.c
index
773be6a
..
7d5d241
100644
(file)
--- a/
src/libsystemd/sd-device/sd-device.c
+++ b/
src/libsystemd/sd-device/sd-device.c
@@
-201,6
+201,10
@@
int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
devpath = syspath + STRLEN("/sys");
+ if (devpath[0] == '\0')
+ /* '/sys' alone is not a valid device path */
+ return -ENODEV;
+
r = device_add_property_internal(device, "DEVPATH", devpath);
if (r < 0)
return r;