dix: don't allow disabling XTest devices

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@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer 2012-10-11 13:02:27 +10:00
parent 5b7384a315
commit aad65415bf
2 changed files with 9 additions and 4 deletions

View File

@ -187,7 +187,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)

View File

@ -145,9 +145,11 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
return BadValue;
/* Don't allow disabling of VCP/VCK */
if ((dev == inputInfo.pointer ||dev ==
inputInfo.keyboard) &&!(*(CARD8 *) prop->data))
/* Don't allow disabling of VCP/VCK or XTest devices */
if ((dev == inputInfo.pointer ||
dev == inputInfo.keyboard ||
IsXTestDevice(dev, NULL))
&&!(*(CARD8 *) prop->data))
return BadAccess;
if (!checkonly) {