Skip to contentSkip to conversation

io_uring/fdinfo: only print ->sq_array[] if it's there

PATCH In review Jens Axboe 2 participants 2 messages Sep 1, 2023 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring/fdinfo: only print ->sq_array[] if it's there

If a ring is setup with IORING_SETUP_NO_SQARRAY, then we don't have the SQ array. Don't try to dump info from it through fdinfo if that is the case.

Reported-by [email protected]
Fixes 2af89abda7d9 ("io_uring: add option to remove SQ indirection")

---

io_uring/fdinfo.c +2 -0
index 300455b4bc12..c53678875416 100644
@@ -93,6 +93,8 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *f)
 		struct io_uring_sqe *sqe;
 		unsigned int sq_idx;
 
+		if (ctx->flags & IORING_SETUP_NO_SQARRAY)
+			break;
 		sq_idx = READ_ONCE(ctx->sq_array[entry & sq_mask]);
 		if (sq_idx > sq_mask)
 			continue;
Signature · 1 line
Jens Axboe
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Jens Axboe

If a ring is setup with IORING_SETUP_NO_SQARRAY, then we don't have the SQ array. Don't try to dump info from it through fdinfo if that is the case.

Reported-by [email protected]
Fixes 2af89abda7d9 ("io_uring: add option to remove SQ indirection")

---

io_uring/fdinfo.c +0 -0
index 300455b4bc12..c53678875416 100644

io_uring/fdinfo.c __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *f) · line 100

Quoted 8 lines
io_uring/fdinfo.c +2 -0
@@ -93,6 +93,8 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *f)
 		struct io_uring_sqe *sqe;
 		unsigned int sq_idx;
 
+		if (ctx->flags & IORING_SETUP_NO_SQARRAY)
+			break;
 		sq_idx = READ_ONCE(ctx->sq_array[entry & sq_mask]);
 		if (sq_idx > sq_mask)
 			continue;
Signature · 1 line
Gabriel Krisman Bertazi