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>
This commit is contained in:
Mukul Joshi 2024-04-18 11:32:34 -04:00 committed by Ksawlii
parent 8853219fb2
commit 39f9ad877c

View file

@ -1259,6 +1259,7 @@ allocate_init_user_pages_failed:
err_bo_create: err_bo_create:
unreserve_mem_limit(adev, size, alloc_domain, !!sg); unreserve_mem_limit(adev, size, alloc_domain, !!sg);
err_reserve_limit: err_reserve_limit:
amdgpu_sync_free(&(*mem)->sync);
mutex_destroy(&(*mem)->lock); mutex_destroy(&(*mem)->lock);
kfree(*mem); kfree(*mem);
err: err: