From: Mukul Joshi Date: Thu, 18 Apr 2024 15:32:34 +0000 (-0400) Subject: drm/amdgpu: Fix leak when GPU memory allocation fails X-Git-Tag: v5.15.158~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d0580ded513d8016384b6e2547fa58096f1126c;p=thirdparty%2Fkernel%2Fstable.git 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 Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 00a8aef48a696..1fae36e33411f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1502,6 +1502,7 @@ err_node_allow: err_bo_create: unreserve_mem_limit(adev, size, alloc_domain, !!sg); err_reserve_limit: + amdgpu_sync_free(&(*mem)->sync); mutex_destroy(&(*mem)->lock); if (gobj) drm_gem_object_put(gobj);