From 4e5ee47860e0ff9b89d865c9487e14e849174898 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 4 May 2017 15:13:33 +1000 Subject: [PATCH] Fix crash when we have multiple keyboard event listeners for the lid switch (#1440927) --- ...the-event-listener-after-removing-it.patch | 53 +++++++++++++++++++ libinput.spec | 8 ++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 0001-lid-re-init-the-event-listener-after-removing-it.patch diff --git a/0001-lid-re-init-the-event-listener-after-removing-it.patch b/0001-lid-re-init-the-event-listener-after-removing-it.patch new file mode 100644 index 0000000..f2033a6 --- /dev/null +++ b/0001-lid-re-init-the-event-listener-after-removing-it.patch @@ -0,0 +1,53 @@ +From 72d597502c3bbf3462887c23afd2f184314409e8 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 4 May 2017 14:50:31 +1000 +Subject: [PATCH libinput] lid: re-init the event listener after removing it + +We may call remove on it again and that segfaults if it hasn't been +initialized. + +Signed-off-by: Peter Hutterer +(cherry picked from commit 3735359f0c66208658754e2c2b5f7e7041a2e290) +--- + src/evdev-lid.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/evdev-lid.c b/src/evdev-lid.c +index 8db7f37c..e71499bb 100644 +--- a/src/evdev-lid.c ++++ b/src/evdev-lid.c +@@ -98,7 +98,9 @@ lid_switch_toggle_keyboard_listener(struct lid_switch_dispatch *dispatch, + dispatch); + } else { + libinput_device_remove_event_listener( +- &dispatch->keyboard.listener); ++ &dispatch->keyboard.listener); ++ libinput_device_init_event_listener( ++ &dispatch->keyboard.listener); + } + } + +@@ -197,7 +199,9 @@ lid_switch_pair_keyboard(struct evdev_device *lid_switch, + if (dispatch->keyboard.keyboard) { + if (bus_kbd != BUS_I8042) + return; ++ + libinput_device_remove_event_listener(&dispatch->keyboard.listener); ++ libinput_device_init_event_listener(&dispatch->keyboard.listener); + } + + dispatch->keyboard.keyboard = keyboard; +@@ -225,7 +229,9 @@ lid_switch_interface_device_removed(struct evdev_device *device, + + if (removed_device == dispatch->keyboard.keyboard) { + libinput_device_remove_event_listener( +- &dispatch->keyboard.listener); ++ &dispatch->keyboard.listener); ++ libinput_device_init_event_listener( ++ &dispatch->keyboard.listener); + dispatch->keyboard.keyboard = NULL; + } + } +-- +2.12.2 + diff --git a/libinput.spec b/libinput.spec index b8c4e19..d413dcc 100644 --- a/libinput.spec +++ b/libinput.spec @@ -5,7 +5,7 @@ Name: libinput Version: 1.7.1 -Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} Summary: Input device library License: MIT @@ -18,11 +18,13 @@ Source2: commitid Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz %endif + Patch01: 0001-touchpad-move-the-pressure-range-to-a-hwdb-entry.patch Patch02: 0002-doc-add-documentation-for-touchpad-pressure-detectio.patch Patch03: 0003-udev-Remove-unused-Elantech-touchpad-model-binding.patch Patch04: 0004-udev-Select-more-generic-pressure-range-values-for-E.patch Patch05: 0005-udev-Add-specific-pressure-range-for-the-ASUS-ZenBoo.patch +Patch06: 0001-lid-re-init-the-event-listener-after-removing-it.patch BuildRequires: git BuildRequires: autoconf automake libtool pkgconfig @@ -100,6 +102,10 @@ find $RPM_BUILD_ROOT -name '*.la' -delete %changelog +* Thu May 04 2017 Peter Hutterer 1.7.1-3 +- Fix crash when we have multiple keyboard event listeners for the lid + switch (#1440927) + * Tue May 02 2017 Peter Hutterer 1.7.1-2 - Add patches to fix elantech pressure detection