a5e2b29
From efa31092d6703397121a0ada4f7205a8ecad3d3d Mon Sep 17 00:00:00 2001
a5e2b29
From: Ander Conselvan de Oliveira <ander@mandriva.com.br>
a5e2b29
Date: Mon, 6 Apr 2009 16:01:20 -0300
a5e2b29
Subject: [PATCH] xfree86: Remove device from inputInfo.devices if ActivateDevice failed.
a5e2b29
a5e2b29
After the call to xf86ActivateDevice, the new device will be added to
a5e2b29
inputInfo.devices. However, if the subsequent call to ActivateDevice
a5e2b29
fails, the correponding InputInfoRec for the device is deleted but an
a5e2b29
entry still remains in inputInfo.devices. This might lead to a server
a5e2b29
crash later on (on InitAndStartDevices for instance) when the device
a5e2b29
control proc would be called for an invalid device.
a5e2b29
a5e2b29
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
a5e2b29
---
a5e2b29
 hw/xfree86/common/xf86Xinput.c |    1 +
a5e2b29
 1 files changed, 1 insertions(+), 0 deletions(-)
a5e2b29
a5e2b29
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
a5e2b29
index 3d89e39..8d08d7e 100644
a5e2b29
--- a/hw/xfree86/common/xf86Xinput.c
a5e2b29
+++ b/hw/xfree86/common/xf86Xinput.c
a5e2b29
@@ -543,7 +543,10 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
a5e2b29
     dev = pInfo->dev;
a5e2b29
     rval = ActivateDevice(dev);
a5e2b29
     if (rval != Success)
a5e2b29
+    {
a5e2b29
+        RemoveDevice(dev);
a5e2b29
         goto unwind;
a5e2b29
+    }
a5e2b29
 
a5e2b29
     /* Enable it if it's properly initialised and we're currently in the VT */
a5e2b29
     if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)