[PATCH] dix: block signals when closing all devices

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 27 15:00:14 PDT 2011

When closing down all devices, we manually unset master for all attached
devices, but the device's sprite info still points to the master's sprite
info. This leaves us a window where the master is freed already but the
device isn't yet. A signal during that window causes dereference of the
already freed spriteInfo in mieqEnqueue's EnqueueScreen macro.

Simply block signals when removing all devices. It's not like we're really
worrying about high-responsive input at this stage.


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Tested-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
The more correct approach would be to loop through inputInfo.devices twice,
removing all slaves first and then the masters. But really, if you're
expecting input events to be delivered while we're shutting down all devices
you're going to be disappointed anyway.

 dix/devices.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dix/devices.c b/dix/devices.c
index 63454fe..4a525d5 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -971,6 +971,8 @@ CloseDownDevices(void)
     DeviceIntPtr dev;
+    OsBlockSignals();
     /* Float all SDs before closing them. Note that at this point resources
      * (e.g. cursors) have been freed already, so we can't just call
      * AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
@@ -993,6 +995,8 @@ CloseDownDevices(void)
     inputInfo.keyboard = NULL;
     inputInfo.pointer = NULL;
+    OsReleaseSignals();

More information about the xorg-devel mailing list