From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH i-g-t 1/2] lib/amdgpu: fix NULL deref computing available_rings in amdgpu_create_ip_queues
Date: Thu, 13 Aug 2026 16:03:22 +0800 [thread overview]
Message-ID: <20260813080337.3327962-1-Jesse.Zhang@amd.com> (raw)
amdgpu_create_ip_queues() dereferenced ring_context->hw_ip_info to compute
available_rings while ring_context was still NULL - it is only allocated later
via calloc(). This crashed the all-queues-with-umq subtest with a SIGSEGV in
amdgpu_create_ip_queues() before any queue was created.
The HW IP info is already queried into the local hw_ip_info at the top of the
function, so read available_rings from that instead of the not-yet-allocated
ring_context.
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
lib/amdgpu/amd_command_submission.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/amdgpu/amd_command_submission.c b/lib/amdgpu/amd_command_submission.c
index 0334c2ded..7210cffb9 100644
--- a/lib/amdgpu/amd_command_submission.c
+++ b/lib/amdgpu/amd_command_submission.c
@@ -181,10 +181,10 @@ static void amdgpu_create_ip_queues(amdgpu_device_handle device,
amdgpu_dma_limits_query(device, &limits);
if (user_queue)
- available_rings = ring_context->hw_ip_info.num_userq_slots ?
- ((1 << ring_context->hw_ip_info.num_userq_slots) -1) : 1;
+ available_rings = hw_ip_info.num_userq_slots ?
+ ((1 << hw_ip_info.num_userq_slots) - 1) : 1;
else
- available_rings = ring_context->hw_ip_info.available_rings;
+ available_rings = hw_ip_info.available_rings;
if (available_rings <= 0) {
*ring_context_out = NULL;
--
2.49.0
next reply other threads:[~2026-08-13 8:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 8:03 Jesse Zhang [this message]
2026-08-13 8:03 ` [PATCH i-g-t 2/2] lib/amdgpu: add gfx12 shader blob for sync_dependency_test Jesse Zhang
2026-08-13 10:59 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,1/2] lib/amdgpu: fix NULL deref computing available_rings in amdgpu_create_ip_queues Patchwork
2026-08-13 11:08 ` ✓ i915.CI.BAT: " Patchwork
2026-08-13 12:51 ` ✓ Xe.CI.FULL: " Patchwork
2026-08-19 1:34 ` [PATCH i-g-t 1/2] " vitaly prosyak
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=20260813080337.3327962-1-Jesse.Zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=vitaly.prosyak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox