[PATCH xf86-input-libinput 2/2] Bail out of PreInit if the parent driver data is NULL

Peter Hutterer peter.hutterer at who-t.net
Mon Aug 8 23:42:28 UTC 2016


If the parent device is removed before the WorkProc is called, the private
data is NULL.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/xf86libinput.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 5873e45..1219f07 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2610,9 +2610,12 @@ xf86libinput_pre_init(InputDriverPtr drv,
 			xf86IDrvMsg(pInfo, X_ERROR, "Failed to find parent device\n");
 			goto fail;
 		}
-		xf86IDrvMsg(pInfo, X_INFO, "is a virtual subdevice\n");
 
 		parent_driver_data = parent->private;
+		if (!parent_driver_data) /* parent already removed again */
+			goto fail;
+
+		xf86IDrvMsg(pInfo, X_INFO, "is a virtual subdevice\n");
 		shared_device = xf86libinput_shared_ref(parent_driver_data->shared_device);
 		device = shared_device->device;
 	}
-- 
2.7.4



More information about the xorg-devel mailing list