Ignore LED updates for disabled devices, avoids a null-pointer dereference

when an AccessX timeout is set
This commit is contained in:
Peter Hutterer 2016-12-21 07:59:44 +10:00
parent b3fa3e4c02
commit ff66f3eef0
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From f47f78eb0bd9fba455f01c8c6dead3bd75242b2b Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 20 Dec 2016 15:36:55 +1000
Subject: [PATCH xf86-input-libinput] Ignore LED updates for disabled devices
If an XKB AccessX timeout is set and a VT switch is triggered, the
AccessXTimeoutExpire function may be called after the device has already been
disabled. This can cause a null-pointer dereference as our shared libinput
device may have been released by then.
In the legacy drivers this would've simply caused a write to an invalid fd
(-1), not a crash. Here we need to be more careful.
https://bugs.freedesktop.org/show_bug.cgi?id=98464
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
src/xf86libinput.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index b130a77..fd38c3b 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -785,6 +785,9 @@ xf86libinput_kbd_ctrl(DeviceIntPtr device, KeybdCtrl *ctrl)
struct xf86libinput *driver_data = pInfo->private;
struct libinput_device *ldevice = driver_data->shared_device->device;
+ if (!device->enabled)
+ return;
+
while (bits[i].xbit) {
if (ctrl->leds & bits[i].xbit)
leds |= bits[i].code;
--
2.9.3

View File

@ -8,7 +8,7 @@
Summary: Xorg X11 libinput input driver
Name: xorg-x11-drv-libinput
Version: 0.23.0
Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
URL: http://www.x.org
License: MIT
@ -20,6 +20,7 @@ Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2
Source1: 71-libinput-overrides-wacom.conf
Patch01: 0001-conf-match-against-tablets-too.patch
Patch02: 0001-Ignore-LED-updates-for-disabled-devices.patch
ExcludeArch: s390 s390x
@ -78,6 +79,10 @@ Xorg X11 libinput input driver development files.
%{_includedir}/xorg/libinput-properties.h
%changelog
* Wed Dec 21 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.23.0-2
- Ignore LED updates for disabled devices, avoids a null-pointer dereference
when an AccessX timeout is set
* Mon Dec 12 2016 Peter Hutterer <peter.hutterer@redhat.com> 0.23.0-1
- libnput 0.23.0