drm/amdgpu: Fix leak when GPU memory allocation fails
authorMukul Joshi <mukul.joshi@amd.com>
Thu, 18 Apr 2024 15:32:34 +0000 (11:32 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 24 Apr 2024 03:17:30 +0000 (23:17 -0400)
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
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

index df58a6a1a67ec51f1bb81ff1bd8364be8a46cc13..7c23ba19af33a181065b3a241cbdb9d4588bb203 100644 (file)
@@ -1854,6 +1854,7 @@ err_node_allow:
 err_bo_create:
        amdgpu_amdkfd_unreserve_mem_limit(adev, aligned_size, flags, xcp_id);
 err_reserve_limit:
+       amdgpu_sync_free(&(*mem)->sync);
        mutex_destroy(&(*mem)->lock);
        if (gobj)
                drm_gem_object_put(gobj);