From: Frediano Ziglio Date: Wed, 3 Jun 2015 11:09:10 +0000 (+0100) Subject: drm/qxl: Do not leak memory if qxl_release_list_add fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8451cc964c1d193b989c41a44e5e77109cc696f8;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git drm/qxl: Do not leak memory if qxl_release_list_add fails 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 Cc: stable@vger.kernel.org Reviewed-by: Dave Airlie Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c index b110883f8253..7354a4cda59d 100644 --- a/drivers/gpu/drm/qxl/qxl_ioctl.c +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c @@ -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; }