evdev: fail before open_restricted if the devnode doesn't exist

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

Debugged-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit cb186abc17)
This commit is contained in:
Peter Hutterer 2018-02-09 19:24:15 +10:00
parent 1b21a4317d
commit 076c7b6c00

View file

@ -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)
return -ENODEV;
fd = open_restricted(libinput, devnode,
O_RDWR | O_NONBLOCK | O_CLOEXEC);