summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander@mandriva.com.br>2009-04-06 16:01:20 -0300
committerKeith Packard <keithp@keithp.com>2009-05-08 12:31:41 -0700
commit0df12a3f01c953c0908b4b53a93fd3a5c704f69b (patch)
treef5cb8540684a93cf4e8c54e96ccee25ed6479140
parent24dc7694a2ba72d45cda7720aeaec8350930edc3 (diff)
xfree86: Remove device from inputInfo.devices if ActivateDevice failed.
After the call to xf86ActivateDevice, the new device will be added to inputInfo.devices. However, if the subsequent call to ActivateDevice fails, the correponding InputInfoRec for the device is deleted but an entry still remains in inputInfo.devices. This might lead to a server crash later on (on InitAndStartDevices for instance) when the device control proc would be called for an invalid device. (cherry picked from commit efa31092d6703397121a0ada4f7205a8ecad3d3d) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/common/xf86Xinput.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 96352a46d..1f412349c 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -543,7 +543,11 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
dev = pInfo->dev;
rval = ActivateDevice(dev);
if (rval != Success)
+ {
+ xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
+ RemoveDevice(dev);
goto unwind;
+ }
/* Enable it if it's properly initialised and we're currently in the VT */
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)