]> git.hungrycats.org Git - linux/commitdiff
drm/qxl: Do not leak memory if qxl_release_list_add fails
authorFrediano Ziglio <fziglio@redhat.com>
Wed, 3 Jun 2015 11:09:10 +0000 (12:09 +0100)
committerJiri Slaby <jslaby@suse.cz>
Tue, 4 Aug 2015 14:52:18 +0000 (16:52 +0200)
commit 8451cc964c1d193b989c41a44e5e77109cc696f8 upstream.

If the function fails reference counter to the object is not decremented
causing leaks.
This is hard to spot as it happens only on very low memory situations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/gpu/drm/qxl/qxl_ioctl.c

index 7b95c75e9626ae1324dea48b310d3052f0c00d2d..729debf83fa3f36dc8f56dc70cd480570b864551 100644 (file)
@@ -122,8 +122,10 @@ static struct qxl_bo *qxlhw_handle_to_bo(struct qxl_device *qdev,
        qobj = gem_to_qxl_bo(gobj);
 
        ret = qxl_release_list_add(release, qobj);
-       if (ret)
+       if (ret) {
+               drm_gem_object_unreference_unlocked(gobj);
                return NULL;
+       }
 
        return qobj;
 }