[PATCH] fix crash with unplugged wacom device

Peter Hutterer peter.hutterer at who-t.net
Tue Apr 14 19:31:02 PDT 2009


On Mon, Apr 06, 2009 at 04:41:01PM -0300, Ander Conselvan de Oliveira wrote:
> Having an input device section for a wacom device causes a server crash if the 
> device is not present. The attached patch (against server-1.6-branch) fixes 
> the issue.
> 
> Thanks,
> Ander
> 
> 
> !DSPAM:49da5b04123371187917547!

> From 2e8b90588e7c43962d288c3c773b495316d5a9d2 Mon Sep 17 00:00:00 2001
> From: Ander Conselvan de Oliveira <ander at mandriva.com.br>
> Date: Mon, 6 Apr 2009 16:01:20 -0300
> Subject: [PATCH] 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.
> ---
>  hw/xfree86/common/xf86Xinput.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index 96352a4..0c0e089 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -542,8 +542,10 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
>  
>      dev = pInfo->dev;
>      rval = ActivateDevice(dev);
> -    if (rval != Success)
> +    if (rval != Success) {
> +        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)
> -- 
> 1.6.2.1
> 

thanks for the patch Ander, and sorry about the delay.
Patch pushd as efa31092d6703397121a0ada4f7205a8ecad3d3d, please nominate for
server 1.6 branch too.

Cheers,
  Peter


More information about the xorg-devel mailing list