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

Submitted by Peter Hutterer on Aug. 8, 2016, 11:42 p.m.

Details

Message ID 1470699748-29517-2-git-send-email-peter.hutterer@who-t.net
State Accepted
Headers show
Series "Series without cover letter" ( rev: 1 ) in X.org

Not browsing as part of any series.

Commit Message

Peter Hutterer Aug. 8, 2016, 11:42 p.m.
If the parent device is removed before the WorkProc is called, the private
data is NULL.

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

Patch hide | download patch | download mbox

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;
 	}