drm/amdgpu: Fix leak when GPU memory allocation fails

[ Upstream commit 25e9227c6afd200bed6774c866980b8e36d033af ]

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: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Mukul Joshi 2024-04-18 11:32:34 -04:00 committed by Greg Kroah-Hartman
parent c8fd5450e4
commit b0b59d1e86

View File

@ -1273,6 +1273,7 @@ allocate_init_user_pages_failed:
err_bo_create:
unreserve_system_mem_limit(adev, size, alloc_domain, false);
err_reserve_limit:
amdgpu_sync_free(&(*mem)->sync);
mutex_destroy(&(*mem)->lock);
kfree(*mem);
return ret;