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>
This commit is contained in:
Dave Airlie 2013-01-09 12:51:45 +10:00
parent 90642948cc
commit da8ee26023
1 changed files with 6 additions and 1 deletions

View File

@ -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]);