From: Sudip Mukherjee Date: Thu, 8 Oct 2015 13:58:01 +0000 (+0530) Subject: drm/amdgpu: fix memory leak in amdgpu_vm_update_page_directory X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7a574557e62dc3d2d7ed55fa0b99e7d5bb403878;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/amdgpu: fix memory leak in amdgpu_vm_update_page_directory If amdgpu_ib_get() fails we returned the error code but we missed freeing ib. Cc: "Christian König" Cc: Jammy Zhou Cc: Chunming Zhou Cc: Alex Deucher Cc: "monk.liu" Signed-off-by: Sudip Mukherjee Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 1e14531353e0..53d551f2d839 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 */