summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukul Joshi <mukul.joshi@amd.com>2024-04-18 18:32:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-02 17:23:44 +0300
commit5ab19dc55c5efa97196c1859e3ebdb2f33cd4f92 (patch)
tree925ca86d6d58a3023a2001204e38fde0153dc241
parent48a92487dbbc2b65b28f827c747c490356025fba (diff)
downloadlinux-5ab19dc55c5efa97196c1859e3ebdb2f33cd4f92.tar.xz
drm/amdgpu: Fix leak when GPU memory allocation fails
commit 25e9227c6afd200bed6774c866980b8e36d033af upstream. Free the sync object if the memory allocation fails for any reason. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 1b4c7ced8b92..4a95a624fca7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1259,6 +1259,7 @@ allocate_init_user_pages_failed:
err_bo_create:
unreserve_mem_limit(adev, size, alloc_domain, !!sg);
err_reserve_limit:
+ amdgpu_sync_free(&(*mem)->sync);
mutex_destroy(&(*mem)->lock);
kfree(*mem);
err: