]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: fix lifetime issue of amdgpu_vm_get_task_info_pasid()
authorShahyan Soltani <shahyan.soltani@amd.com>
Mon, 6 Jul 2026 12:15:21 +0000 (08:15 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 Jul 2026 20:30:53 +0000 (16:30 -0400)
commit04cc4aa3617b0ed67e859f91f09de5d896a46f3a
treee79e9057c17c0c093f8cf13713b67ba159257467
parent614e8a989d462876c4f6a659f56e1075e72ad515
drm/amdgpu: fix lifetime issue of amdgpu_vm_get_task_info_pasid()

The vm pointer returned from amdgpu_vm_get_vm_from_pasid() is only
valid while the lock is still being held. Once xa_unlock_irqrestore is
called and returned, the pointer is no longer under lock and is subject
to modification. Since, the caller still dereferences vm->task_info in
amdgpu_vm_get_task_info_vm() after the lock is removed, this causes a
use after unlock problem.

Remove the lifetime issue present in amdgpu_vm_get_task_info_pasid()
through removing the amdgpu_vm_get_vm_from_pasid() function from
amdgpu_vm.c and making the relevant code inline to hold the lock while
it is still in use.

Signed-off-by: Shahyan Soltani <shahyan.soltani@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 9d01579f3f868b333acc901815972685989092c7)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c