* [PATCH] drm/amdgpu: Fix last_update fence leak in amdgpu_vm_init()
@ 2026-09-16 9:55 Wentao Liang
2026-09-16 14:29 ` Deucher, Alexander
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16 9:55 UTC (permalink / raw)
To: Lang.Yu
Cc: airlied, alexander.deucher, amd-gfx, christian.koenig, dri-devel,
linux-kernel, simona, Wentao Liang, stable
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.
Fixes: 187916e6ed9d ("drm/amdgpu: install stub fence into potential unused fence pointers")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index fccd758b6699..494197ac20e8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread* RE: [PATCH] drm/amdgpu: Fix last_update fence leak in amdgpu_vm_init()
2026-09-16 9:55 [PATCH] drm/amdgpu: Fix last_update fence leak in amdgpu_vm_init() Wentao Liang
@ 2026-09-16 14:29 ` Deucher, Alexander
0 siblings, 0 replies; 2+ messages in thread
From: Deucher, Alexander @ 2026-09-16 14:29 UTC (permalink / raw)
To: Wentao Liang, Yu, Lang
Cc: airlied, amd-gfx, Koenig, Christian, dri-devel, linux-kernel,
simona, stable
AMD General
Applied. Thanks!
> -----Original Message-----
> From: Wentao Liang <vulab@iscas.ac.cn>
> Sent: Wednesday, September 16, 2026 5:56 AM
> To: Yu, Lang <Lang.Yu@amd.com>
> Cc: airlied@gmail.com; Deucher, Alexander <Alexander.Deucher@amd.com>;
> amd-gfx@lists.freedesktop.org; Koenig, Christian
> <Christian.Koenig@amd.com>; dri-devel@lists.freedesktop.org; linux-
> kernel@vger.kernel.org; simona@ffwll.ch; Wentao Liang <vulab@iscas.ac.cn>;
> stable@vger.kernel.org
> Subject: [PATCH] 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.
>
> Fixes: 187916e6ed9d ("drm/amdgpu: install stub fence into potential unused
> fence pointers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index fccd758b6699..494197ac20e8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-16 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 9:55 [PATCH] drm/amdgpu: Fix last_update fence leak in amdgpu_vm_init() Wentao Liang
2026-09-16 14:29 ` Deucher, Alexander
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®