From 8650ff14a52047173fa32f12f22ec6f4e38ff433 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 9 Jan 2013 12:48:30 +1000 Subject: [PATCH] modesetting: fix crashes caused by udev race conditions So the kernel removes the device, and the driver processes the first udev event, and gets no output back from the kernel, so it check and don't fall over. This fixes a couple of crashes seen when hotplugging USB devices. Signed-off-by: Dave Airlie --- hw/xfree86/drivers/modesetting/drmmode_display.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 8d760c277..42cd5ac26 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -589,6 +589,8 @@ drmmode_output_detect(xf86OutputPtr output) drmModeFreeConnector(drmmode_output->mode_output); drmmode_output->mode_output = drmModeGetConnector(drmmode->fd, drmmode_output->output_id); + if (!drmmode_output->mode_output) + return XF86OutputStatusDisconnected; switch (drmmode_output->mode_output->connection) { case DRM_MODE_CONNECTED: @@ -683,6 +685,9 @@ drmmode_output_dpms(xf86OutputPtr output, int mode) drmModeConnectorPtr koutput = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; + if (!koutput) + return; + drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id, drmmode_output->dpms_enum_id, mode); return;