]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amdkfd: Fix a race condition of vram buffer unref in svm code
authorXiaogang Chen <xiaogang.chen@amd.com>
Wed, 27 Sep 2023 16:20:28 +0000 (11:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 16:56:16 +0000 (16:56 +0000)
commit7d43cdd22cd81a2b079e864c4321b9aba4c6af34
treee2b7ca0fa183a3b6c64a21621a56df25bac2b676
parenteea81424c5b83f52c656d4be0793f3e22c6e86bc
drm/amdkfd: Fix a race condition of vram buffer unref in svm code

[ Upstream commit 709c348261618da7ed89d6c303e2ceb9e453ba74 ]

prange->svm_bo unref can happen in both mmu callback and a callback after
migrate to system ram. Both are async call in different tasks. Sync svm_bo
unref operation to avoid random "use-after-free".

Signed-off-by: Xiaogang Chen <xiaogang.chen@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Jesse Zhang <Jesse.Zhang@amd.com>
Tested-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdkfd/kfd_svm.c