[PATCH xserver] Xi: Hold the input lock when sending events

Olivier Fourdan ofourdan at redhat.com
Wed Feb 22 09:48:24 UTC 2017


Otherwise the output buffer will be accessed from different threads and
cause all sorts of nasty and painful memory corruptions.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99164
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99887
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 Xi/xiproperty.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index b7a1f59..a68b4b3 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -203,10 +203,12 @@ send_property_event(DeviceIntPtr dev, Atom property, int what)
         .what = what
     };
 
+    input_lock();
     SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
 
     SendEventToAllWindows(dev, GetEventFilter(dev, (xEvent *) &xi2),
                           (xEvent *) &xi2, 1);
+    input_unlock();
 }
 
 static int
-- 
2.9.3



More information about the xorg-devel mailing list