summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-01-19 08:17:58 +0100
committerDave Airlie <airlied@redhat.com>2009-01-19 08:17:58 +0100
commitc1ff85d97708550e634fb6fa099c463db90fc40d (patch)
tree58d06ba7fb375232ec614bc78db39faceb7898c6 /drivers/gpu/drm/drm_stub.c
parentLinux 2.6.29-rc2 (diff)
downloadlinux-c1ff85d97708550e634fb6fa099c463db90fc40d.tar.xz
linux-c1ff85d97708550e634fb6fa099c463db90fc40d.zip
drm: fix leak of device mappings since multi-master changes.
Device maps now contain a link to the master that created them, so when cleaning up the master, remove any maps that are connected to it. Also delete any remaining maps at driver unload time. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r--drivers/gpu/drm/drm_stub.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 5ca132afa4f2..46bb923b097c 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -118,12 +118,20 @@ static void drm_master_destroy(struct kref *kref)
struct drm_master *master = container_of(kref, struct drm_master, refcount);
struct drm_magic_entry *pt, *next;
struct drm_device *dev = master->minor->dev;
+ struct drm_map_list *r_list, *list_temp;
list_del(&master->head);
if (dev->driver->master_destroy)
dev->driver->master_destroy(dev, master);
+ list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
+ if (r_list->master == master) {
+ drm_rmmap_locked(dev, r_list->map);
+ r_list = NULL;
+ }
+ }
+
if (master->unique) {
drm_free(master->unique, master->unique_size, DRM_MEM_DRIVER);
master->unique = NULL;