Fix a crash when setting properties on a disabled device
This commit is contained in:
parent
536eb3fe74
commit
a48ad212a4
58
0001-Ignore-property-changes-if-the-device-is-disabled.patch
Normal file
58
0001-Ignore-property-changes-if-the-device-is-disabled.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 97857beac4621f79c6b853c37357573ae11038f7 Mon Sep 17 00:00:00 2001
|
||||
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||
Date: Tue, 24 Feb 2015 16:12:16 +0100
|
||||
Subject: [PATCH xf86-input-libinput] Ignore property changes if the device is
|
||||
disabled
|
||||
|
||||
If the device is present but disabled, the server will still call into
|
||||
SetProperty. We don't have a libinput device to back it up in this case,
|
||||
causing a null-pointer dereference.
|
||||
|
||||
This is a bug specific to this driver that cannot easily be fixed. All other
|
||||
drivers can handle property changes even if no device is present, here we rely
|
||||
on libinput to make the final call. But without a device path/fd we don't have
|
||||
a libinput reference
|
||||
|
||||
The protocol doesn't mention this case, so let's pick BadMatch as the least
|
||||
wrong error code. And put a warning in the log, this needs a workaround in the
|
||||
client.
|
||||
|
||||
Also, if we get here and the device is on, then that's definitely a bug, warn
|
||||
about that.
|
||||
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=89296
|
||||
|
||||
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
---
|
||||
src/libinput.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/libinput.c b/src/libinput.c
|
||||
index eee3bfb..482e0d7 100644
|
||||
--- a/src/libinput.c
|
||||
+++ b/src/libinput.c
|
||||
@@ -1550,8 +1550,20 @@ static int
|
||||
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
+ InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
+ struct xf86libinput *driver_data = pInfo->private;
|
||||
+ struct libinput_device *device = driver_data->device;
|
||||
int rc;
|
||||
|
||||
+ if (device == NULL && checkonly) {
|
||||
+ BUG_WARN(dev->public.on);
|
||||
+ xf86IDrvMsg(pInfo, X_INFO,
|
||||
+ "SetProperty on %d called but device is disabled.\n"
|
||||
+ "This driver cannot change properties on a disabled device\n",
|
||||
+ atom);
|
||||
+ return BadMatch;
|
||||
+ }
|
||||
+
|
||||
if (atom == prop_tap)
|
||||
rc = LibinputSetPropertyTap(dev, atom, val, checkonly);
|
||||
else if (atom == prop_calibration)
|
||||
--
|
||||
2.1.0
|
||||
|
@ -5,7 +5,7 @@
|
||||
Summary: Xorg X11 libinput input driver
|
||||
Name: xorg-x11-drv-libinput
|
||||
Version: 0.7.0
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
URL: http://ww.x.org
|
||||
License: MIT
|
||||
|
||||
@ -13,6 +13,7 @@ Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2
|
||||
Source1: 90-libinput.conf
|
||||
|
||||
Patch01: 0001-Fix-off-by-one-error-in-buttonmap-initialization-893.patch
|
||||
Patch02: 0001-Ignore-property-changes-if-the-device-is-disabled.patch
|
||||
|
||||
ExcludeArch: s390 s390x
|
||||
|
||||
@ -33,6 +34,7 @@ supporting all devices.
|
||||
%prep
|
||||
%setup -q -n %{tarball}-%{version}
|
||||
%patch01 -p1
|
||||
%patch02 -p1
|
||||
|
||||
%build
|
||||
autoreconf --force -v --install || exit 1
|
||||
@ -68,6 +70,9 @@ Xorg X11 libinput input driver development files.
|
||||
%{_includedir}/xorg/libinput-properties.h
|
||||
|
||||
%changelog
|
||||
* Wed Feb 25 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.7.0-3
|
||||
- Fix a crash when setting properties on a disabled device
|
||||
|
||||
* Wed Feb 25 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.7.0-2
|
||||
- Fix stack smash on pointer init (#1195905)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user