From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
Sunil Khatri <sunil.khatri@amd.com>,
Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH 2/2] drm/amdgpu: don't unreserve the freed root PD in amdgpu_vm_init()
Date: Thu, 19 Nov 2026 17:56:44 +0800 [thread overview]
Message-ID: <20261119095652.3510341-2-Jesse.Zhang@amd.com> (raw)
In-Reply-To: <20261119095652.3510341-1-Jesse.Zhang@amd.com>
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>
---
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:
--
2.50.1
next prev parent reply other threads:[~2026-11-19 9:57 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 ` Jesse Zhang [this message]
2026-11-19 14:46 ` [PATCH 2/2] drm/amdgpu: don't unreserve the freed root PD in amdgpu_vm_init() Christian König
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=20261119095652.3510341-2-Jesse.Zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--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.