drm/armada: plug leak in dumb_map_offset
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 23 Nov 2015 09:32:43 +0000 (10:32 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 3 Dec 2015 15:55:19 +0000 (15:55 +0000)
We need to drop the gem bo reference if it's an imported one.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/gpu/drm/armada/armada_gem.c

index aaf88641bfc51ce1629c901f4f3672c49b1556c7..2a3ef7938f30c8bdbdb03e2e44f7a72149bc4004 100644 (file)
@@ -285,7 +285,7 @@ int armada_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
        /* Don't allow imported objects to be mapped */
        if (obj->obj.import_attach) {
                ret = -EINVAL;
-               goto err_unlock;
+               goto err_unref;
        }
 
        ret = drm_gem_create_mmap_offset(&obj->obj);
@@ -294,6 +294,7 @@ int armada_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
                DRM_DEBUG_DRIVER("handle %#x offset %llx\n", handle, *offset);
        }
 
+ err_unref:
        drm_gem_object_unreference(&obj->obj);
  err_unlock:
        mutex_unlock(&dev->struct_mutex);