Re: [PATCH v3 1/5] drm/amdgpu: fix NULL deref in error path
From: Christian König
Date: Fri Oct 30 2026 - 05:33:14 EST
On 10/29/26 16:19, Pierre-Eric Pelloux-Prayer wrote:
> IF we hit the "error_free_root" error path, amdgpu_vm_pt_free_root
> is called which will clear vm->root.bo so calling amdgpu_bo_unreserve
> will crash.
> Since root_bo is a reference to the BO previously installed as
> vm->root.bo, use it.
>
> Fixes: 8473bfdcb5b1 ("drm/amdgpu: fix error handling in amdgpu_vm_init")
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@xxxxxxx>
IIRC somebody from the community stumbled over that already and I already reviewed the patch.
Looks like it was missed to be picked up to amd-staging-drm-next.
Anyway that one here is Reviewed-by: Christian König <christian.koenig@xxxxxxx>
Regards,
Christian.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 000c982816a7..ea8688061237 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2716,7 +2716,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>
> error_free_root:
> amdgpu_vm_pt_free_root(adev, vm);
> - amdgpu_bo_unreserve(vm->root.bo);
> + amdgpu_bo_unreserve(root_bo);
> amdgpu_bo_unref(&root_bo);
>
> error_free_delayed: