]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: fix a memory leak in fence cleanup when unloading
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 4 Sep 2025 16:35:05 +0000 (12:35 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Sep 2025 14:37:32 +0000 (16:37 +0200)
commit 7838fb5f119191403560eca2e23613380c0e425e upstream.

Commit b61badd20b44 ("drm/amdgpu: fix usage slab after free")
reordered when amdgpu_fence_driver_sw_fini() was called after
that patch, amdgpu_fence_driver_sw_fini() effectively became
a no-op as the sched entities we never freed because the
ring pointers were already set to NULL.  Remove the NULL
setting.

Reported-by: Lin.Cao <lincao12@amd.com>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Fixes: b61badd20b44 ("drm/amdgpu: fix usage slab after free")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit a525fa37aac36c4591cc8b07ae8957862415fbd5)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

index 7c5584742471e9c2103343309f4c0d6f238c5ace..a0b7ac7486dc5583d387ca501332708001d2dd44 100644 (file)
@@ -389,8 +389,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
        dma_fence_put(ring->vmid_wait);
        ring->vmid_wait = NULL;
        ring->me = 0;
-
-       ring->adev->rings[ring->idx] = NULL;
 }
 
 /**