]> git.ipfire.org Git - thirdparty/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 21:46:33 +0000 (16:46 -0500)
commit6ba60345f45eaf7cb4f89105d26083a4b9fd1cba
treec8eca78ef57b0b369419aeec29300a1ee0ccb374
parent08b1eb621cc32819b7958a15cff10016b03b7aff
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c