All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Jesse Zhang <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, Sunil Khatri <sunil.khatri@amd.com>
Subject: Re: [PATCH 2/2] drm/amdgpu: don't unreserve the freed root PD in amdgpu_vm_init()
Date: Thu, 19 Nov 2026 15:46:36 +0100	[thread overview]
Message-ID: <6cd1af3d-4647-4cdf-a351-b65effdfab48@amd.com> (raw)
In-Reply-To: <20261119095652.3510341-2-Jesse.Zhang@amd.com>



On 11/19/26 10:56, Jesse Zhang wrote:
> The error path of amdgpu_vm_init() frees the root PD, which clears
> vm->root.bo, and then unreserves vm->root.bo. On navi48, with an
> allocation after reserving the root PD failing through failslab while
> opening the render node:
> 
>   Oops: general protection fault, probably for non-canonical address 0xdffffc000000005e: 0000 [#1] SMP KASAN NOPTI
>   KASAN: null-ptr-deref in range [0x00000000000002f0-0x00000000000002f7]
>   RIP: 0010:amdgpu_vm_init+0xa9f/0x1480 [amdgpu]
>    amdgpu_driver_open_kms+0x2b1/0xd10 [amdgpu]
>    drm_file_alloc+0x58f/0xac0 [drm]
>    drm_open_helper+0x1b3/0x4b0 [drm]
> 
> Unreserve it through root_bo, which still holds a reference. With this
> and the entity fix 4842 opens with allocations failing in turn don't
> oops anymore.
> 
> Fixes: 8473bfdcb5b1 ("drm/amdgpu: fix error handling in amdgpu_vm_init")
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>

That is already fixed with:

commit 26401a4999f1596a515b2e704e7066ac09306488
Author: Christian König <ckoenig.leichtzumerken@gmail.com>
Date:   Wed Oct 7 14:46:57 2026 +0200

    drm/exec: don't immediately add prelocked obj to array of locked objs
    

Regards,
Christian

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 8cc5964f29c0..272eac0ef317 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2718,8 +2718,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>  	return 0;
>  
>  error_free_root:
> +	/* This clears vm->root.bo, root_bo keeps the BO alive */
>  	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:


  reply	other threads:[~2026-11-19 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:56 [PATCH 1/2] drm/amdgpu: reserve a fence slot before adding the eviction fence Jesse Zhang
2026-11-19  9:56 ` [PATCH 2/2] drm/amdgpu: don't unreserve the freed root PD in amdgpu_vm_init() Jesse Zhang
2026-11-19 14:46   ` Christian König [this message]
2026-11-19 15:54     ` Alex Deucher
2026-11-19 23:43       ` Zhang, Jesse(Jie)
2026-11-20 12:00         ` Christian König
2026-11-19 10:13 ` [PATCH 1/2] drm/amdgpu: reserve a fence slot before adding the eviction fence sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cd1af3d-4647-4cdf-a351-b65effdfab48@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=sunil.khatri@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.