All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"monk.liu" <monk.liu@amd.com>
Subject: [PATCH RESEND 3/3] drm/amdgpu: fix memory leak
Date: Thu,  8 Oct 2015 19:28:01 +0530	[thread overview]
Message-ID: <1444312681-10149-3-git-send-email-sudipm.mukherjee@gmail.com> (raw)
In-Reply-To: <1444312681-10149-1-git-send-email-sudipm.mukherjee@gmail.com>

If amdgpu_ib_get() fails we returned the error code but we missed
freeing ib.

Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jammy Zhou <Jammy.Zhou@amd.com>
Cc: Chunming Zhou <david1.zhou@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "monk.liu" <monk.liu@amd.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

Sent on 18/09/2015 

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 1e14531..53d551f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -455,8 +455,10 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
 		return -ENOMEM;
 
 	r = amdgpu_ib_get(ring, NULL, ndw * 4, ib);
-	if (r)
+	if (r) {
+		kfree(ib);
 		return r;
+	}
 	ib->length_dw = 0;
 
 	/* walk over the address space and update the page directory */
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Jammy Zhou" <Jammy.Zhou@amd.com>,
	"Chunming Zhou" <david1.zhou@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"monk.liu" <monk.liu@amd.com>
Subject: [PATCH RESEND 3/3] drm/amdgpu: fix memory leak
Date: Thu,  8 Oct 2015 19:28:01 +0530	[thread overview]
Message-ID: <1444312681-10149-3-git-send-email-sudipm.mukherjee@gmail.com> (raw)
In-Reply-To: <1444312681-10149-1-git-send-email-sudipm.mukherjee@gmail.com>

If amdgpu_ib_get() fails we returned the error code but we missed
freeing ib.

Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jammy Zhou <Jammy.Zhou@amd.com>
Cc: Chunming Zhou <david1.zhou@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "monk.liu" <monk.liu@amd.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

Sent on 18/09/2015 

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 1e14531..53d551f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -455,8 +455,10 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
 		return -ENOMEM;
 
 	r = amdgpu_ib_get(ring, NULL, ndw * 4, ib);
-	if (r)
+	if (r) {
+		kfree(ib);
 		return r;
+	}
 	ib->length_dw = 0;
 
 	/* walk over the address space and update the page directory */
-- 
1.9.1


  parent reply	other threads:[~2015-10-08 13:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 13:57 [PATCH RESEND 1/3] drm/i915: use error path Sudip Mukherjee
2015-10-08 13:57 ` Sudip Mukherjee
2015-10-08 13:58 ` [PATCH RESEND 2/3] drm/i915: check for return value Sudip Mukherjee
2015-10-08 13:58   ` Sudip Mukherjee
2015-10-08 14:29   ` Daniel Vetter
2015-10-08 14:29     ` Daniel Vetter
2015-12-09 11:39     ` Sudip Mukherjee
2015-12-09 11:39       ` Sudip Mukherjee
2015-12-09 13:33       ` Daniel Vetter
2015-12-09 13:33         ` Daniel Vetter
2015-10-08 13:58 ` Sudip Mukherjee [this message]
2015-10-08 13:58   ` [PATCH RESEND 3/3] drm/amdgpu: fix memory leak Sudip Mukherjee
2015-10-08 16:20   ` Alex Deucher
2015-10-08 16:20     ` Alex Deucher
2015-10-08 14:30 ` [PATCH RESEND 1/3] drm/i915: use error path Daniel Vetter
2015-10-08 14:30   ` Daniel Vetter

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=1444312681-10149-3-git-send-email-sudipm.mukherjee@gmail.com \
    --to=sudipm.mukherjee@gmail.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monk.liu@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.