]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: Fix double deletion of validate_list
authorHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Fri, 9 Jan 2026 20:26:36 +0000 (15:26 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Feb 2026 22:24:21 +0000 (17:24 -0500)
commit6b61a54e684006ca0d92d684a1d3c3a00f077d8f
tree4127f442c5eda13f15fe4c4297c914ae4f08039e
parent84962445cd8a83dc5bed4c8ad5bbb2c1cdb249a0
drm/amdgpu: Fix double deletion of validate_list

If amdgpu_amdkfd_gpuvm_free_memory_of_gpu() fails after kgd_mem is
removed from validate_list, the mem handle still lingers in the KFD idr.
This means when process is terminated,
kfd_process_free_outstanding_kfd_bos() will call
amdgpu_amdkfd_gpuvm_free_memory_of_gpu() again resulting in double
deletion.

To avoid this -
 (a) Check if list is empty before deleting it
 (b) Rearragne amdgpu_amdkfd_gpuvm_free_memory_of_gpu() such that it can
     be safely called again if it returns failure the first time.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 6ba60345f45eaf7cb4f89105d26083a4b9fd1cba)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c