summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-01-09 12:51:45 +1000
committerDave Airlie <airlied@redhat.com>2013-03-01 18:14:27 +1000
commitda8ee26023fc2868fe970471195a5f3c86fb574b (patch)
tree2c099c7f31317c07f4e2137797f95d86ef404ee1 /hw
parent90642948cc78834d95f7a3bddaac7ff77b68ed7e (diff)
xfree86/hotplug: cleanup properly if the screen fails to initialise
Due to another bug, the modesetting/udl driver would fail to init properly on hotplug, when it did the code didn't clean up properly, and on removing the device the server could crash. Found in F18 testing. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86platformBus.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 0525e39bc..58663336a 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -438,7 +438,12 @@ xf86platformAddDevice(int index)
}
scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL);
-
+ if (scr_index == -1) {
+ xf86DeleteScreen(xf86GPUScreens[i]);
+ xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
+ xf86NumGPUScreens = old_screens;
+ return -1;
+ }
dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates,
xf86ScreenKey, xf86GPUScreens[i]);