[PATCH] dix: don't allow disabling XTest devices

Peter Hutterer peter.hutterer at who-t.net
Wed Oct 10 21:56:17 PDT 2012


Disabling a XTest device followed by an XTest API call crashes the server.
This could be fixed elsewhere but disabled devices must not send events
anyway. The use-case for disabled XTest devices is somewhat limited, so
simply disallow disabling the devices.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/chgdctl.c  | 5 ++++-
 dix/devices.c | 6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index 9fe69a5..d47a588 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -186,7 +186,10 @@ ProcXChangeDeviceControl(ClientPtr client)
     case DEVICE_ENABLE:
         e = (xDeviceEnableCtl *) &stuff[1];
 
-        status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
+        if (IsXTestDevice(dev, NULL))
+            status = !Success;
+        else
+            status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
 
         if (status == Success) {
             if (e->enable)
diff --git a/dix/devices.c b/dix/devices.c
index 66d4406..7a7d03f 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -146,8 +146,10 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
             return BadValue;
 
         /* Don't allow disabling of VCP/VCK */
-        if ((dev == inputInfo.pointer ||dev ==
-             inputInfo.keyboard) &&!(*(CARD8 *) prop->data))
+        if ((dev == inputInfo.pointer ||
+             dev == inputInfo.keyboard ||
+             IsXTestDevice(dev, NULL))
+            &&!(*(CARD8 *) prop->data))
             return BadAccess;
 
         if (!checkonly) {
-- 
1.7.11.4



More information about the xorg-devel mailing list