[PATCH] xfree86/hotplug: cleanup properly if the screen fails to initialise

Aaron Plattner aplattner at nvidia.com
Wed Dec 12 08:17:36 PST 2012


On 12/11/2012 08:14 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> 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 at redhat.com>

Seems reasonable, so
Reviewed-by: Aaron Plattner <aplattner at nvidia.com>

Should InitOutput make its calls to AddGPUScreen similarly non-fatal?

Also, should the !xf86GPUScreens[i]->configured failure path also call 
xf86UnclaimPlatformSlot?

-- Aaron

> ---
>   hw/xfree86/common/xf86platformBus.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
> index 0525e39..5866333 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]);
>
>



More information about the xorg-devel mailing list