[PATCH libinput] evdev: fail before open_restricted if the devnode doesn't exist
Peter Hutterer
peter.hutterer at who-t.net
Fri Feb 9 09:59:08 UTC 2018
https://bugzilla.redhat.com/show_bug.cgi?id=1536633
https://bugzilla.redhat.com/show_bug.cgi?id=1539046
https://bugzilla.redhat.com/show_bug.cgi?id=1539783
https://bugzilla.redhat.com/show_bug.cgi?id=1540662
https://bugs.freedesktop.org/show_bug.cgi?id=104278
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Can you give this one a try please? Quick fix but it passes the test suite.
src/evdev.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/evdev.c b/src/evdev.c
index d1ca243d..d412eeb0 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1917,6 +1917,11 @@ evdev_device_create(struct libinput_seat *seat,
const char *devnode = udev_device_get_devnode(udev_device);
const char *sysname = udev_device_get_sysname(udev_device);
+ if (!devnode) {
+ log_info(libinput, "%s: no device node associated\n", sysname);
+ return NULL;
+ }
+
if (udev_device_should_be_ignored(udev_device)) {
log_debug(libinput, "%s: device is ignored\n", sysname);
return NULL;
@@ -2434,6 +2439,9 @@ evdev_device_resume(struct evdev_device *device)
return -ENODEV;
devnode = udev_device_get_devnode(device->udev_device);
+ if (devnode == NULL)
+ return -ENODEV;
+
fd = open_restricted(libinput, devnode,
O_RDWR | O_NONBLOCK | O_CLOEXEC);
--
2.14.3
More information about the wayland-devel
mailing list