[PATCH xserver] os: don't re-remove an already removed fd

Peter Hutterer peter.hutterer at who-t.net
Thu Aug 11 04:05:44 UTC 2016


If a driver calls xf86RemoveEnabledDevice() twice for the same fd we race with
InputThreadDoWork(). If it gets called in between both fd entries are removed.
If InputThreadDoWork() does not get called in between, we merely try to remove
the same fd twice and then cause a read_input() call on an already removed
device later.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 os/inputthread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/os/inputthread.c b/os/inputthread.c
index cb3af06..c3b03f6 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -240,7 +240,7 @@ InputThreadUnregisterDev(int fd)
 
     input_lock();
     xorg_list_for_each_entry(dev, &inputThreadInfo->devs, node)
-        if (dev->fd == fd) {
+        if (dev->fd == fd && dev->state != device_state_removed) {
             found_device = TRUE;
             break;
         }
-- 
2.7.4



More information about the xorg-devel mailing list