From 2e5d33a53e675ad8fae3250fbd08b228e4ddcdbd Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 13 Feb 2018 14:43:23 +1000 Subject: [PATCH] Fix crasher due to missing devnode after resume (#1536633) --- ...e-open_restricted-if-the-devnode-doe.patch | 47 +++++++++++++++++++ libinput.spec | 7 ++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 0001-evdev-fail-before-open_restricted-if-the-devnode-doe.patch diff --git a/0001-evdev-fail-before-open_restricted-if-the-devnode-doe.patch b/0001-evdev-fail-before-open_restricted-if-the-devnode-doe.patch new file mode 100644 index 0000000..4494695 --- /dev/null +++ b/0001-evdev-fail-before-open_restricted-if-the-devnode-doe.patch @@ -0,0 +1,47 @@ +From cb186abc17ad9e525609dc32385b0a7992e949a9 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 9 Feb 2018 19:24:15 +1000 +Subject: [PATCH libinput] 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 +Signed-off-by: Peter Hutterer +--- + src/evdev.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/evdev.c b/src/evdev.c +index d1ca243d..63b93ec3 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) ++ return -ENODEV; ++ + fd = open_restricted(libinput, devnode, + O_RDWR | O_NONBLOCK | O_CLOEXEC); + +-- +2.14.3 + diff --git a/libinput.spec b/libinput.spec index d950b94..1a9bd4a 100644 --- a/libinput.spec +++ b/libinput.spec @@ -5,7 +5,7 @@ Name: libinput Version: 1.10.0 -Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} Summary: Input device library License: MIT @@ -18,6 +18,8 @@ Source2: commitid Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz %endif +Patch01: 0001-evdev-fail-before-open_restricted-if-the-devnode-doe.patch + BuildRequires: git-core BuildRequires: gcc BuildRequires: meson @@ -109,6 +111,9 @@ The %{name}-utils package contains tools to debug hardware and analyze %{_mandir}/man1/libinput-measure-trackpoint-range.1* %changelog +* Tue Feb 13 2018 Peter Hutterer 1.10.0-2 +- Fix crasher due to missing devnode after resume (#1536633) + * Tue Feb 13 2018 Peter Hutterer 1.10.0-1 - libinput 1.10