Skip to content

Commit

Permalink
drm: don't double-free on driver load error
Browse files Browse the repository at this point in the history
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 8f6599d (drm: delay minor
destruction to drm_dev_free()). Instead unplug them.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reported-and-tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Ilia Mirkin authored and Dave Airlie committed Dec 13, 2013
1 parent 0ca9fff commit 0f58411
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/drm_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,11 +566,11 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
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);
Expand Down

0 comments on commit 0f58411

Please sign in to comment.