drm/amdgpu: Fix last_update fence leak in amdgpu_vm_init()
Subsystems (3)
PATCH 1/1 drm/amdgpu: Fix last_update fence leak in amdgpu_vm_init()
amdgpu_vm_init() initializes vm->last_update, vm->last_unlocked and vm->last_tlb_flush with references to the stub fence taken via dma_fence_get_stub(). The error label at the end of the function releases the last_unlocked and last_tlb_flush references with dma_fence_put(), but the reference stored in vm->last_update is never dropped, so whenever the page table root creation, the reservation of the root BO or the PASID registration fails, the stub fence reference leaks.
Drop the vm->last_update reference together with the other stub fence references on the error path.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -0
@@ -2693,6 +2693,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,amdgpu_bo_unref (&root_bo); error_free_delayed: +dma_fence_put (vm->last_update);dma_fence_put (vm->last_tlb_flush);dma_fence_put (vm->last_unlocked);ttm_lru_bulk_move_fini (&adev->mman.bdev, &vm->lru_bulk_move);
Signature · 1 line
2.34.1
AMD General
Applied. Thanks!
Quoted 47 lines
-----Original Message-----
From: Wentao Liang <[email protected]>
Sent: Wednesday, September 16, 2026 5:56 AM
To: Yu, Lang <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; [email protected]; Koenig, Christian <[email protected]>; [email protected]; linux- [email protected]; [email protected]; Wentao Liang <[email protected]>; [email protected]
Subject: [PATCH] drm/amdgpu: Fixlast_updatefence leak inamdgpu_vm_init()
amdgpu_vm_init()initializesvm->last_update,vm->last_unlockedandvm->last_tlb_flushwith references to the stub fence taken viadma_fence_get_stub(). The error label at the end of the function releases thelast_unlockedandlast_tlb_flushreferences withdma_fence_put(), but the reference stored invm->last_updateis never dropped, so whenever the page table root creation, the reservation of the root BO or the PASID registration fails, the stub fence reference leaks.Drop the
vm->last_updatereference together with the other stub fence references on the error path.Fixes 187916e6ed9d ("drm/amdgpu: install stub fence into potential unusedfence pointers")
Signed-off-by Wentao Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-0@@ -2693,6 +2693,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev,struct amdgpu_vm *vm, amdgpu_bo_unref(&root_bo); error_free_delayed: +dma_fence_put (vm->last_update);dma_fence_put (vm->last_tlb_flush);dma_fence_put (vm->last_unlocked);ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move);--
2.34.1