From: sashiko-bot@kernel.org
To: "Thadeu Lima de Souza Cascardo" <cascardo@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] Revert "drm/amdgpu: debugfs: avoid extra EOLs in amdgpu_gem_info"
Date: Tue, 08 Sep 2026 20:15:03 +0000 [thread overview]
Message-ID: <20260908201504.5C9411F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260908-amdgpu_debugfs-v1-1-3b659e744691@igalia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] NULL pointer dereference when printing imported BOs in debugfs.
--
commit be759dc89504ad9041bef159ec02b120e04cf61b
Author: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Revert "drm/amdgpu: debugfs: avoid extra EOLs in amdgpu_gem_info"
This commit reverts an earlier change that removed newlines when no fences
were attached to a dma_resv struct. The original change caused multiple BOs
to be printed on the same line, reducing debugfs readability.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 5d9d137209b6f..1b6c32a177fb6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1701,9 +1701,8 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)
[Severity: High]
This is a pre-existing issue, but can the access to dma_buf->file cause a
NULL pointer dereference?
In amdgpu_bo_print_info(), earlier in this function:
dma_buf = READ_ONCE(bo->tbo.base.dma_buf);
attachment = READ_ONCE(bo->tbo.base.import_attach);
if (attachment)
seq_printf(m, " imported from ino:%llu", file_inode(dma_buf->file)->i_ino);
If attachment is non-NULL, dma_buf is dereferenced via
file_inode(dma_buf->file)->i_ino. However, bo->tbo.base.dma_buf can be NULL
for imported BOs in several scenarios:
- BOs imported via amdgpu_gem_prime_import() allocate a fresh GEM object
via amdgpu_dma_buf_create_obj(), which does not populate obj->dma_buf
and relies entirely on obj->import_attach.
- When userspace closes the GEM handle of a BO,
drm_gem_object_handle_put_unlocked() calls
drm_gem_object_exported_dma_buf_free(), explicitly setting
obj->dma_buf = NULL, even though the BO itself may still be kept alive
if it is mapped.
When debugfs iterates over these BOs, reading dma_buf->file dereferences a
NULL pointer. Since this can be triggered by reading debugfs files like
amdgpu_vm_info, could this deterministically oops the system?
> if (dma_resv_trylock(bo->tbo.base.resv)) {
> dma_resv_describe(bo->tbo.base.resv, m);
> dma_resv_unlock(bo->tbo.base.resv);
> - } else {
> - seq_puts(m, "\n");
> }
> + seq_puts(m, "\n");
>
> return size;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-amdgpu_debugfs-v1-1-3b659e744691@igalia.com?part=1
next prev parent reply other threads:[~2026-09-08 20:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 19:59 [PATCH] Revert "drm/amdgpu: debugfs: avoid extra EOLs in amdgpu_gem_info" Thadeu Lima de Souza Cascardo
2026-09-08 20:15 ` sashiko-bot [this message]
2026-09-08 21:39 ` Alex Deucher
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=20260908201504.5C9411F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cascardo@igalia.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.