Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157334

[PATCH 02/11] drm/qxl: Do not leak memory if qxl_release_list_add fails

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Frediano Ziglio <fziglio@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 02/11] drm/qxl: Do not leak memory if qxl_release_list_add fails
Date Wed, 03 Jun 2015 13:30:02 +0200
Message-ID <pxf1U-7Sy-13@gated-at.bofh.it> (permalink)
References <pxeIy-7uH-29@gated-at.bofh.it>
X-Original-To fziglio@redhat.com, spice-devel@lists.freedesktop.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, airlied@redhat.com
X-Scanned-By MIMEDefang 2.68 on 10.5.11.26
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 34
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org
X-Original-Date Wed, 3 Jun 2015 12:09:10 +0100
X-Original-Message-ID <1433329759-10082-3-git-send-email-fziglio@redhat.com>
X-Original-References <1433329759-10082-1-git-send-email-fziglio@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1157334

Show key headers only | View raw


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>
---
 drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index afd7297..e8b5207 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;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 02/11] drm/qxl: Do not leak memory if qxl_release_list_add fails Frediano Ziglio <fziglio@redhat.com> - 2015-06-03 13:30 +0200

csiph-web