[PATCH v2] drm: don't double-free on driver load error

David Herrmann dh.herrmann at gmail.com
Thu Dec 5 07:53:51 PST 2013


Hi

On Thu, Dec 5, 2013 at 3:42 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> All instances of drm_dev_register are followed by drm_dev_free on
> failure. Don't free dev->control/render/primary on failure, as they will
> be freed by drm_dev_free since commit 8f6599da8e (drm: delay minor
> destruction to drm_dev_free()). Instead unplug them.
>
> Reported-by: Bruno Prémont <bonbons at linux-vserver.org>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---

Thanks, looks good now:

Reviewed-by: David Herrmann <dh.herrmann at gmail.com>

Thanks
David

> v2: use drm_unplug_minor instead of just removing the puts, as suggested by
>     David Herrman.
>
>  drivers/gpu/drm/drm_stub.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index f53d524..66dd3a0 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -566,11 +566,11 @@ err_unload:
>         if (dev->driver->unload)
>                 dev->driver->unload(dev);
>  err_primary_node:
> -       drm_put_minor(dev->primary);
> +       drm_unplug_minor(dev->primary);
>  err_render_node:
> -       drm_put_minor(dev->render);
> +       drm_unplug_minor(dev->render);
>  err_control_node:
> -       drm_put_minor(dev->control);
> +       drm_unplug_minor(dev->control);
>  err_agp:
>         if (dev->driver->bus->agp_destroy)
>                 dev->driver->bus->agp_destroy(dev);
> --
> 1.8.3.2
>


More information about the dri-devel mailing list