Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] lib/amdgpu: fix NULL deref computing available_rings in amdgpu_create_ip_queues
@ 2026-08-13  8:03 Jesse Zhang
  2026-08-13  8:03 ` [PATCH i-g-t 2/2] lib/amdgpu: add gfx12 shader blob for sync_dependency_test Jesse Zhang
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jesse Zhang @ 2026-08-13  8:03 UTC (permalink / raw)
  To: igt-dev; +Cc: Vitaly Prosyak, Alex Deucher, Christian Koenig, Jesse Zhang

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-19  1:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13  8:03 [PATCH i-g-t 1/2] lib/amdgpu: fix NULL deref computing available_rings in amdgpu_create_ip_queues Jesse Zhang
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox