diff mbox

[RESEND,3/3] drm/amdgpu: fix memory leak

Message ID 1444312681-10149-3-git-send-email-sudipm.mukherjee@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sudip Mukherjee Oct. 8, 2015, 1:58 p.m. UTC
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(-)

Comments

Alex Deucher Oct. 8, 2015, 4:20 p.m. UTC | #1
On Thu, Oct 8, 2015 at 9:58 AM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> 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

I somehow missed this before.  Applied.  Thanks!

Alex

>
>  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
diff mbox

Patch

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 */