merge / xf86-input-tslib

X.org tslib input driver
MIT License
7 stars 2 forks source link

Causing X to segfault #5

Open lovesegfault opened 6 years ago

lovesegfault commented 6 years ago

Whenever I install this from the AUR on my Raspberry Pi (armv7h, not AArch64) it causes X to segfault. As soon as I uninstall it X goes back to working normally. Here's the log from X: xorg.log

merge commented 6 years ago

Thanks for reporting!

We might have a design flaw here and I'll fix this properly, but it'll take some time.

In the meantime: Could test xf86-input-tslib with the following change?:

diff --git a/src/tslib.c b/src/tslib.c
index fbbfe93..c547658 100644
--- a/src/tslib.c
+++ b/src/tslib.c
@@ -50,6 +50,7 @@
 #include <sys/time.h>
 #include <time.h>
 #include <stdint.h>
+#include <fcntl.h>

 #if defined (__FreeBSD__)
 #include <dev/evdev/input.h>
@@ -463,8 +463,6 @@ static int xf86TslibInit(__attribute__ ((unused)) InputDriverPtr drv,

        priv->slots = 0;

-       pInfo->fd = ts_fd(priv->ts);
-
        ts_error_fn = errfn;

        /* process generic options */
@@ -475,6 +473,18 @@ static int xf86TslibInit(__attribute__ ((unused)) InputDriverPtr drv,
        if (!priv->valuators)
                return BadValue;

+       /* FIXME get the path from libts (ts_uinput needs that too) */
+       if (!s) {
+               xf86IDrvMsg(pInfo, X_ERROR, "Please provide path or Device");
+               return BadValue;
+       }
+
+       pInfo->fd = open(s, O_RDONLY);
+       if (pInfo->fd == -1) {
+               xf86IDrvMsg(pInfo, X_ERROR, "Couldn't open %s\n", s);
+               return BadValue;
+       }
+
        if (ioctl(pInfo->fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) < 0) {
                xf86IDrvMsg(pInfo, X_ERROR, "ioctl EVIOCGBIT failed");
                return BadValue;

and Set Option "Device" "/dev/input/eventX" in 80-tslib.conf ?

I know it's very ugly, but if this works for you, it would be great to know. I will fix it to work automatically. If I'm lazy, I'll require a new version of tslib to be installed, but even then, I'll document and write log messages that clear up confusion.

merge commented 6 years ago

So. I don't know if you can test, but when you use the current master state of both tslib and xf86-input-tslib, Xorg shouldn't lock up anymore. BUT Xorg still uses the CPU or loops or whatever. I don't have time to debug it right now...

In case you can test: You'd simply ./configure --prefix=/usr and make, make install for both tslib and xf86-input-tslib. (and make unstall in the xf86-input-tslib directory to get rid of it again)

... and in that case forget my previous comment. You should be able to use it without modifying anything.

thanks

merge commented 6 years ago

I think the issue is fixed now. Still if you could run the test installation I described above it'd be great.

In order to automatic detection, the new tslib is needed. So I'll create tslib-1.15-rc1 very soon, then you don't have to take the master branch from git.

And there's xf86-input-tslib 1.2.0-rc1 already, for convenience.

hvraven commented 6 years ago

I still see the same issue. I am trying to install tslib and xf86-input-tslib on raspbian on a Raspberry Pi 3 (armv7l). I am using git checkouts for both and can successfully build both backages, but get a segfault with null pointer dereference (log). I am using tslib-1.15-rc3 and xf86-input-tslib-1.2.0-rc1.

merge commented 6 years ago

Thanks! Could you directly post or upload the log in github here?

Am 30. Dezember 2017 16:32:54 MEZ schrieb "Hendrik v. Raven" notifications@github.com:

I still see the same issue. I am trying to install tslib and xf86-input-tslib on raspbian on a Raspberry Pi 3 (armv7l). I am using git checkouts for both and can successfully build both backages, but get a segfault with null pointer dereference (log). I am using tslib-1.15-rc3 and xf86-input-tslib-1.2.0-rc1.

-- Martin Kepplinger http://martinkepplinger.com sent from mobile

hvraven commented 6 years ago

Mhm, sprunge does not seem to like me, I uploaded it again as gist. If there is something else you need I am happy to provide me if you tell me how.

dougg3 commented 6 years ago

I'm still seeing the crash as well. I tracked it down to the following. When my (non-multitouch eGalax) touchscreen is plugged in, it creates both a /dev/input/event0 and /dev/input/mouse0 device. It seems as though when the mouse0 device gets rejected, X segfaults for whatever reason. I tried to do a stack trace, but the stack was hosed and I didn't have time to investigate. The default 80-tslib.conf is matching on /dev/input/*. If I change this to /dev/input/event*, the segfault goes away.

With that said, my touchscreen still doesn't work properly. Probably beyond the scope of this issue, but it seems that the new multitouch stuff might have broken non-multitouch screens. Every ts_read_mt call in ReadInputMT (which is called because it's a new version of tslib that supports multitouch) is returning -EAGAIN, so none of the touch events make it through. Downgrading to 0.0.7 fixes it.

KwonTae-young commented 6 years ago

I am using /dev/input/event* to modify it like "dougg3".

In my case, the following devices exist in /dev/input/ folder.

root@test:~# ls -al /dev/input/
total 0
drwxr-xr-x  2 root root     120 Jan 16 09:28 .
drwxr-xr-x 11 root root    3760 Jan 16 09:30 ..
crw-rw----  1 root input 13, 64 Jan 16 09:28 event0
crw-rw----  1 root input 13, 63 Jan 16 09:28 mice
crw-rw----  1 root input 13, 32 Jan 16 09:28 mouse0
lrwxrwxrwx  1 root root       6 Jan 16 09:28 touchscreen0 -> event0
root@test:~#

In my case, a Segmentation fault occurs when ioctl() is used for /dev/input/mouse0. https://github.com/merge/xf86-input-tslib/blob/e74682c815cd81f87a6fddd359b594038341c6d9/src/tslib.c#L494-L499

/dev/input/mouse0 is generated by drivers/input/mousedev.c of the kernel.
https://github.com/torvalds/linux/blob/255442c93843f52b6891b21d0b485bf2c97f93c3/drivers/input/mousedev.c#L882 https://github.com/torvalds/linux/blob/255442c93843f52b6891b21d0b485bf2c97f93c3/drivers/input/mousedev.c#L908-L912

However, the driver does not support the ioctl() function. https://github.com/torvalds/linux/blob/255442c93843f52b6891b21d0b485bf2c97f93c3/drivers/input/mousedev.c#L774-L785 I think this probably caused a segmentation fault.

neilabdev commented 4 years ago

+1

Thanks for the great work. I'm using Buildroot to create a distribution using Linux 4.19.23 kernel with X11 1.20.5. It comes with driver 1.1.1, but replaced it with hopes that 1.2.0-rc1 would fix the issue, but did not. Would reverting to an older version without multi-touch work? Any working version would be fine with me, or other solution.

# cat /var/log/Xorg.0.log
[   234.463]
X.Org X Server 1.20.5
X Protocol Version 11, Revision 0
[   234.464] Build Operating System: Linux 4.18.0-25-generic x86_64
[   234.464] Current Operating System: Linux raspberry_pi 4.19.23 #1 Fri Jul 26 18:05:00 PDT 2019 armv6l
[   234.465] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=800 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:20:EC:46 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  root=/dev/mmcblk0p2 rootwait console=tty3 console=ttyAMA0,115200
[   234.466] Build Date: 26 July 2019  06:00:28PM
[   234.467]
[   234.467] Current version of pixman: 0.38.4
[   234.468]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[   234.468] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[   234.480] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Jan  1 00:03:54 1970
[   234.497] (==) Using config file: "/etc/X11/xorg.conf"
[   234.497] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[   234.510] (==) No Layout section.  Using the first Screen section.
[   234.511] (==) No screen section available. Using defaults.
[   234.511] (**) |-->Screen "Default Screen Section" (0)
[   234.511] (**) |   |-->Monitor "<default monitor>"
[   234.518] (==) No device specified for screen "Default Screen Section".
    Using the first device section listed.
[   234.518] (**) |   |-->Device "Allwinner A10/A13 FBDEV"
[   234.519] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
[   234.519] (==) Automatically adding devices
[   234.519] (==) Automatically enabling devices
[   234.519] (==) Automatically adding GPU devices
[   234.538] (==) Max clients allowed: 256, resource mask: 0x1fffff
[   234.549] (WW) The directory "/usr/share/fonts/X11//TTF/" does not exist.
[   234.554]    Entry deleted from font path.
[   234.554] (WW) The directory "/usr/share/fonts/X11//OTF/" does not exist.
[   234.555]    Entry deleted from font path.
[   234.555] (WW) The directory "/usr/share/fonts/X11//Type1/" does not exist.
[   234.555]    Entry deleted from font path.
[   234.561] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/X11//100dpi/".
[   234.561]    Entry deleted from font path.
[   234.561]    (Run 'mkfontdir' on "/usr/share/fonts/X11//100dpi/").
[   234.563] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/X11//75dpi/".
[   234.563]    Entry deleted from font path.
[   234.563]    (Run 'mkfontdir' on "/usr/share/fonts/X11//75dpi/").
[   234.563] (==) FontPath set to:
    /usr/share/fonts/X11//misc/
[   234.563] (==) ModulePath set to "/usr/lib/xorg/modules"
[   234.563] (II) The server relies on udev to provide the list of input devices.
    If no devices become available, reconfigure udev or disable AutoAddDevices.
[   234.563] (II) Loader magic: 0x1d8dc8
[   234.563] (II) Module ABI versions:
[   234.564]    X.Org ANSI C Emulation: 0.4
[   234.564]    X.Org Video Driver: 24.0
[   234.564]    X.Org XInput driver : 24.1
[   234.564]    X.Org Server Extension : 10.0
[   234.565] (II) no primary bus or device found
[   234.566] (II) LoadModule: "fbturbo"
[   234.579] (II) Loading /usr/lib/xorg/modules/drivers/fbturbo_drv.so
[   234.584] (II) Module fbturbo: vendor="X.Org Foundation"
[   234.584]    compiled for 1.20.5, module version = 0.4.0
[   234.584]    Module class: X.Org Video Driver
[   234.585]    ABI class: X.Org Video Driver, version 24.0
[   234.585] (II) FBTURBO: driver for framebuffer: fbturbo
[   234.585] (--) using VT number 4

[   234.597] (WW) Falling back to old probe method for fbturbo
[   234.597] (II) Loading sub module "fbdevhw"
[   234.597] (II) LoadModule: "fbdevhw"
[   234.598] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so
[   234.609] (II) Module fbdevhw: vendor="X.Org Foundation"
[   234.615]    compiled for 1.20.5, module version = 0.0.2
[   234.615]    ABI class: X.Org Video Driver, version 24.0
[   234.616] (II) FBTURBO(0): using /dev/fb0
[   234.616] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[   234.617] (II) FBTURBO(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
[   234.617] (==) FBTURBO(0): Depth 24, (==) framebuffer bpp 32
[   234.617] (==) FBTURBO(0): RGB weight 888
[   234.617] (==) FBTURBO(0): Default visual is TrueColor
[   234.618] (==) FBTURBO(0): Using gamma correction (1.0, 1.0, 1.0)
[   234.618] (II) FBTURBO(0): hardware: BCM2708 FB (video memory: 1500kB)
[   234.618] (DB) xf86MergeOutputClassOptions unsupported bus type 0
[   234.618] (**) FBTURBO(0): Option "fbdev" "/dev/fb0"
[   234.619] (**) FBTURBO(0): Option "SwapbuffersWait" "true"
[   234.630] (II) FBTURBO(0): processor: ARM1176
[   234.630] (II) FBTURBO(0): checking modes against framebuffer device...
[   234.630] (II) FBTURBO(0): checking modes against monitor...
[   234.631] (II) FBTURBO(0): Virtual size is 800x480 (pitch 800)
[   234.631] (**) FBTURBO(0):  Built-in mode "current"
[   234.631] (==) FBTURBO(0): DPI set to (96, 96)
[   234.631] (II) Loading sub module "fb"
[   234.631] (II) LoadModule: "fb"
[   234.632] (II) Loading /usr/lib/xorg/modules/libfb.so
[   234.651] (II) Module fb: vendor="X.Org Foundation"
[   234.652]    compiled for 1.20.5, module version = 1.0.0
[   234.652]    ABI class: X.Org ANSI C Emulation, version 0.4
[   234.676] (II) FBTURBO(0): using backing store heuristics
[   234.828] (II) FBTURBO(0): can't load 'g2d_23' kernel module
[   234.829] (II) FBTURBO(0): failed to enable the use of sunxi display controller
[   234.829] (II) FBTURBO(0): No sunxi-g2d hardware detected (check /dev/disp and /dev/g2d)
[   234.830] (II) FBTURBO(0): G2D hardware acceleration can't be enabled
[   234.830] (II) FBTURBO(0): enabled fbdev copyarea acceleration
[   234.830] (==) FBTURBO(0): Backing store enabled
[   234.843] (==) FBTURBO(0): DPMS enabled
[   234.843] (II) FBTURBO(0): failed to enable hardware cursor
[   234.843] (II) FBTURBO(0): no 3D acceleration because the driver has been compiled without libUMP
[   234.843] (II) FBTURBO(0): if this is wrong and needs to be fixed, please check ./configure log
[   234.844] (II) Initializing extension Generic Event Extension
[   234.844] (II) Initializing extension SHAPE
[   234.844] (II) Initializing extension MIT-SHM
[   234.845] (II) Initializing extension XInputExtension
[   234.848] (II) Initializing extension XTEST
[   234.849] (II) Initializing extension BIG-REQUESTS
[   234.849] (II) Initializing extension SYNC
[   234.849] (II) Initializing extension XKEYBOARD
[   234.849] (II) Initializing extension XC-MISC
[   234.849] (II) Initializing extension XFIXES
[   234.850] (II) Initializing extension RENDER
[   234.850] (II) Initializing extension RANDR
[   234.850] (II) Initializing extension COMPOSITE
[   234.851] (II) Initializing extension DAMAGE
[   234.851] (II) Initializing extension MIT-SCREEN-SAVER
[   234.851] (II) Initializing extension DOUBLE-BUFFER
[   234.851] (II) Initializing extension RECORD
[   234.851] (II) Initializing extension DPMS
[   234.851] (II) Initializing extension Present
[   234.852] (II) Initializing extension DRI3
[   234.852] (II) Initializing extension X-Resource
[   234.852] (II) Initializing extension XVideo
[   234.852] (II) Initializing extension XVideo-MotionCompensation
[   234.852] (II) Initializing extension XFree86-VidModeExtension
[   234.852] (II) Initializing extension XFree86-DGA
[   234.853] (II) Initializing extension DRI2
[   235.445] (II) config/udev: Adding input device Apple, Inc Apple Keyboard (/dev/input/event1)
[   235.445] (**) Apple, Inc Apple Keyboard: Applying InputClass "evdev keyboard catchall"
[   235.446] (**) Apple, Inc Apple Keyboard: Applying InputClass "libinput keyboard catchall"
[   235.446] (II) LoadModule: "libinput"
[   235.451] (II) Loading /usr/lib/xorg/modules/input/libinput_drv.so
[   235.493] (II) Module libinput: vendor="X.Org Foundation"
[   235.493]    compiled for 1.20.5, module version = 0.28.2
[   235.493]    Module class: X.Org XInput Driver
[   235.494]    ABI class: X.Org XInput driver, version 24.1
[   235.494] (II) Using input driver 'libinput' for 'Apple, Inc Apple Keyboard'
[   235.494] (**) Apple, Inc Apple Keyboard: always reports core events
[   235.494] (**) Option "Device" "/dev/input/event1"
[   235.495] (**) Option "_source" "server/udev"
[   235.618] (II) event1  - Apple, Inc Apple Keyboard: is tagged by udev as: Keyboard
[   235.618] (II) event1  - Apple, Inc Apple Keyboard: device is a keyboard
[   235.625] (II) event1  - Apple, Inc Apple Keyboard: device removed
[   235.627] (**) Option "config_info" "udev:/sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:05AC:0220.0003/input/input2/event1"
[   235.627] (II) XINPUT: Adding extended input device "Apple, Inc Apple Keyboard" (type: KEYBOARD, id 6)
[   235.658] (II) event1  - Apple, Inc Apple Keyboard: is tagged by udev as: Keyboard
[   235.658] (II) event1  - Apple, Inc Apple Keyboard: device is a keyboard
[   235.669] (II) config/udev: Adding input device Apple, Inc Apple Keyboard (/dev/input/event2)
[   235.675] (**) Apple, Inc Apple Keyboard: Applying InputClass "evdev keyboard catchall"
[   235.675] (**) Apple, Inc Apple Keyboard: Applying InputClass "libinput keyboard catchall"
[   235.676] (II) Using input driver 'libinput' for 'Apple, Inc Apple Keyboard'
[   235.676] (**) Apple, Inc Apple Keyboard: always reports core events
[   235.676] (**) Option "Device" "/dev/input/event2"
[   235.677] (**) Option "_source" "server/udev"
[   235.694] (II) event2  - Apple, Inc Apple Keyboard: is tagged by udev as: Keyboard
[   235.694] (II) event2  - Apple, Inc Apple Keyboard: device is a keyboard
[   235.695] (II) event2  - Apple, Inc Apple Keyboard: device removed
[   235.695] (**) Option "config_info" "udev:/sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.1/0003:05AC:0220.0004/input/input3/event2"
[   235.695] (II) XINPUT: Adding extended input device "Apple, Inc Apple Keyboard" (type: KEYBOARD, id 7)
[   235.719] (II) event2  - Apple, Inc Apple Keyboard: is tagged by udev as: Keyboard
[   235.719] (II) event2  - Apple, Inc Apple Keyboard: device is a keyboard
[   235.735] (II) config/udev: Adding input device Mitsumi Electric Apple Optical USB Mouse (/dev/input/event3)
[   235.736] (**) Mitsumi Electric Apple Optical USB Mouse: Applying InputClass "evdev pointer catchall"
[   235.736] (**) Mitsumi Electric Apple Optical USB Mouse: Applying InputClass "libinput pointer catchall"
[   235.736] (II) Using input driver 'libinput' for 'Mitsumi Electric Apple Optical USB Mouse'
[   235.736] (**) Mitsumi Electric Apple Optical USB Mouse: always reports core events
[   235.737] (**) Option "Device" "/dev/input/event3"
[   235.737] (**) Option "_source" "server/udev"
[   235.810] (II) event3  - Mitsumi Electric Apple Optical USB Mouse: is tagged by udev as: Mouse
[   235.811] (II) event3  - Mitsumi Electric Apple Optical USB Mouse: device is a pointer
[   235.812] (II) event3  - Mitsumi Electric Apple Optical USB Mouse: device removed
[   235.813] (**) Option "config_info" "udev:/sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2.3/1-1.2.3:1.0/0003:05AC:0304.0005/input/input4/event3"
[   235.814] (II) XINPUT: Adding extended input device "Mitsumi Electric Apple Optical USB Mouse" (type: MOUSE, id 8)
[   235.816] (**) Option "AccelerationScheme" "none"
[   235.817] (**) Mitsumi Electric Apple Optical USB Mouse: (accel) selected scheme none/0
[   235.817] (**) Mitsumi Electric Apple Optical USB Mouse: (accel) acceleration factor: 2.000
[   235.817] (**) Mitsumi Electric Apple Optical USB Mouse: (accel) acceleration threshold: 4
[   235.890] (II) event3  - Mitsumi Electric Apple Optical USB Mouse: is tagged by udev as: Mouse
[   235.891] (II) event3  - Mitsumi Electric Apple Optical USB Mouse: device is a pointer
[   235.896] (II) config/udev: Adding input device Mitsumi Electric Apple Optical USB Mouse (/dev/input/mouse1)
[   235.896] (II) No input driver specified, ignoring this device.
[   235.897] (II) This device may have been added with another device file.
[   235.902] (II) config/udev: Adding input device TSTP MTouch (/dev/input/event0)
[   235.902] (**) TSTP MTouch: Applying InputClass "evdev touchscreen catchall"
[   235.902] (**) TSTP MTouch: Applying InputClass "libinput touchscreen catchall"
[   235.903] (**) TSTP MTouch: Applying InputClass "tslib touchscreen catchall"
[   235.903] (II) LoadModule: "tslib"
[   235.904] (II) Loading /usr/lib/xorg/modules/input/tslib_drv.so
[   235.909] (II) Module tslib: vendor="X.Org Foundation"
[   235.909]    compiled for 1.20.5, module version = 1.2.0
[   235.910]    Module class: X.Org XInput Driver
[   235.910]    ABI class: X.Org XInput driver, version 24.1
[   235.910] (II) Using input driver 'tslib' for 'TSTP MTouch'
[   235.910] (**) TSTP MTouch: always reports core events
[   235.911] (**) Option "path" "/dev/input/event0"
[   236.000] (II) tslib: TSTP MTouch: using libts ABI version 0 (000A02)
[   236.001] (**) TSTP MTouch: always reports core events
[   236.006] (**) Option "config_info" "udev:/sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:0416:C168.0001/input/input1/event0"
[   236.006] (II) XINPUT: Adding extended input device "TSTP MTouch" (type: TOUCHSCREEN, id 9)
[   236.060] (II) config/udev: Adding input device TSTP MTouch (/dev/input/mouse0)
[   236.061] (**) TSTP MTouch: Applying InputClass "tslib touchscreen catchall"
[   236.061] (II) Using input driver 'tslib' for 'TSTP MTouch'
[   236.061] (**) TSTP MTouch: always reports core events
[   236.062] (**) Option "path" "/dev/input/mouse0"
[   236.063] (II) tslib: TSTP MTouch: using libts ABI version 0 (000A02)
[   236.063] (**) TSTP MTouch: always reports core events
[   236.063] (EE) tslib: TSTP MTouch: ioctl EVIOCGBIT failed(EE) PreInit returned 2 for "TSTP MTouch"
[   236.064] (EE) Segmentation fault at address 0x0
[   236.064] (EE)
Fatal server error:
[   236.064] (EE) Caught signal 11 (Segmentation fault). Server aborting
[   236.065] (EE)
[   236.065] (EE)
Please consult the The X.Org Foundation support
     at http://wiki.x.org
 for help.
[   236.065] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[   236.065] (EE)
[   236.081] (EE) Server terminated with error (1). Closing log file.
merge commented 4 years ago

@neilabdev please try using version 0.0.7. It won't have multitouch, but should work.

ar-speakerbus commented 3 years ago

Regarding the segfault crash in the log of the above comment dated 27 July 2019, I recently got the same crash on an i.MX6 CPU using software from a Buildroot-based distribution. I have determined exactly how the crash happens. When tslib.c xf86TslibInit() gets an error from ioctl EVIOCGBIT, it returns BadValue with the pInfo struct only partly initialised and pInfo->dev is NULL. The X server's xf86Xinput.c then calls xf86TslibUninit() due to the BadValue, which crashes due to priv->samp_mt being NULL and would probably also give a crash in xf86TslibControlProc() due to pInfo->dev being NULL. If tslib.c xf86TslibInit() fails at other points, then other parts of the pInfo struct could also be NULL, and if its initial calloc() failed then pInfo->private would be null. The attached patch is intended to protect xf86TslibUninit() from dereferencing NULL pointers, but I have only tested it for the case when the ioctl EVIOCGBIT failed. fix-uninit-crash-patch.txt