From: Rakib Mullick <rakib.mullick@gmail.com>
To: dri-devel <dri-devel@lists.freedesktop.org>,
linux-kernel@vger.kernel.org
Cc: David Airlie <airlied@linux.ie>,
Keith Packard <keithp@keithp.com>,
akpm@linux-foundation.org
Subject: [PATCH] drm, i915: Fix memory leak in i915_gem_busy_ioctl().
Date: Wed, 16 Nov 2011 00:49:28 +0600 [thread overview]
Message-ID: <1321382968.8791.4.camel@localhost.localdomain> (raw)
A call to i915_add_request() has been made in function i915_gem_busy_ioctl(). i915_add_request can fail,
so in it's exit path previously allocated memory needs to be freed.
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d18b07a..2dc24ab 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3512,9 +3512,11 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
* so emit a request to do so.
*/
request = kzalloc(sizeof(*request), GFP_KERNEL);
- if (request)
+ if (request) {
ret = i915_add_request(obj->ring, NULL, request);
- else
+ if (ret)
+ kfree(request);
+ } else
ret = -ENOMEM;
}
next reply other threads:[~2011-11-15 18:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-15 18:49 Rakib Mullick [this message]
2011-11-21 16:23 ` [PATCH] drm, i915: Fix memory leak in i915_gem_busy_ioctl() Daniel Vetter
2011-11-21 17:16 ` Keith Packard
2011-11-26 4:44 ` Rakib Mullick
2011-11-26 10:57 ` Chris Wilson
2011-11-26 16:29 ` Rakib Mullick
2011-11-26 16:53 ` Chris Wilson
2011-11-28 4:29 ` Rakib Mullick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1321382968.8791.4.camel@localhost.localdomain \
--to=rakib.mullick@gmail.com \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=keithp@keithp.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox