[xorg-x11-server] Fix server crash when a XI 1.x device grab is activated on a disabled

Peter Hutterer whot at fedoraproject.org
Tue Nov 27 23:44:57 UTC 2012


commit 45aae11391849e651876ab8c508f314301992b11
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Nov 28 08:48:32 2012 +1000

    Fix server crash when a XI 1.x device grab is activated on a disabled
    
      synaptics touchpad is disabled

 ...sh-on-XI-1.x-grabs-on-disabled-devices.-5.patch |   60 ++++++++++++++++++++
 xorg-x11-server.spec                               |    9 +++-
 2 files changed, 68 insertions(+), 1 deletions(-)
---
diff --git a/0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch b/0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch
new file mode 100644
index 0000000..02db1ca
--- /dev/null
+++ b/0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch
@@ -0,0 +1,60 @@
+From 9d6b8365702e4648e793fea21ad22f7174558680 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Fri, 28 Sep 2012 11:49:29 +1000
+Subject: [PATCH] dix: fix crash on XI 1.x grabs on disabled devices. 
+ (#54934)
+
+If the device is disabled, the sprite window is NULL and dereferencing
+crashes the server.
+
+This is only triggered for XI 1.x grabs (ProcXGrabDevice) as XI2 grabs would
+trigger another code path, creating a sprite for the disabled device as if
+detaching it (which is wrong and fixed with this patch too).
+
+Grabbing a disabled device doesn't make sense as it won't send events
+anyway. However, the protocol specs do not prohibit it, so we need to keep
+it working.
+Luckily, oldWin is only used for focus out events, which aren't necessary
+given that the device is disabled.
+
+X.Org Bug 54934 <http://bugs.freedesktop.org/show_bug.cgi?id=54934>
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>
+---
+ dix/events.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/dix/events.c b/dix/events.c
+index 3b40446..c0e330b 100644
+--- a/dix/events.c
++++ b/dix/events.c
+@@ -1555,11 +1555,13 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
+     WindowPtr oldWin;
+ 
+     /* slave devices need to float for the duration of the grab. */
+-    if (grab->grabtype == XI2 &&
++    if (grab->grabtype == XI2 && keybd->enabled &&
+         !(passive & ImplicitGrabMask) && !IsMaster(keybd))
+         DetachFromMaster(keybd);
+ 
+-    if (grabinfo->grab)
++    if (!keybd->enabled)
++        oldWin = NULL;
++    else if (grabinfo->grab)
+         oldWin = grabinfo->grab->window;
+     else if (keybd->focus)
+         oldWin = keybd->focus->win;
+@@ -1569,7 +1571,8 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
+         oldWin = keybd->focus->win;
+     if (keybd->valuator)
+         keybd->valuator->motionHintWindow = NullWindow;
+-    DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
++    if (oldWin)
++        DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
+     if (syncEvents.playingEvents)
+         grabinfo->grabTime = syncEvents.time;
+     else
+-- 
+1.7.11.7
+
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 030ba11..98d07e9 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -43,7 +43,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.13.0
-Release:   8%{?gitdate:.%{gitdate}}%{dist}
+Release:   9%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -131,6 +131,9 @@ Patch7060:  0001-xf86-Fix-build-against-recent-Linux-kernel.patch
 # Fix non-PCI configuration-less setups
 Patch7061:  v2-xf86-Fix-non-PCI-configuration-less-setups.patch
 
+# fdo Bug 54934 - Crash on XGrabDevice() of deactivated synaptics device -
+Patch7062: 0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch
+
 %global moduledir	%{_libdir}/xorg/modules
 %global drimoduledir	%{_libdir}/dri
 %global sdkdir		%{_includedir}/xorg
@@ -603,6 +606,10 @@ rm -rf $RPM_BUILD_ROOT
 %{xserver_source_dir}
 
 %changelog
+* Wed Nov 28 2012 Peter Hutterer <peter.hutterer at redhat.com> 1.13.0-9
+- Fix server crash when a XI 1.x device grab is activated on a disabled
+  synaptics touchpad is disabled
+
 * Tue Nov 27 2012 Jiri Kastner <jkastner at redhat.com> 1.13.0-8
 - Fix for non-PCI configuration-less setups
 


More information about the scm-commits mailing list