diff mbox series

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

Message ID 6a715702-69e6-48a0-b278-5624d0c5c58d@kernel.dk (mailing list archive)
State New
Headers show
Series io_uring/fdinfo: only print ->sq_array[] if it's there | expand

Commit Message

Jens Axboe Sept. 1, 2023, 8:01 p.m. UTC
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: syzbot+216e2ea6e0bf4a0acdd7@syzkaller.appspotmail.com
Fixes: 2af89abda7d9 ("io_uring: add option to remove SQ indirection")
Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

Comments

Gabriel Krisman Bertazi Sept. 1, 2023, 8:58 p.m. UTC | #1
Jens Axboe <axboe@kernel.dk> writes:

> 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: syzbot+216e2ea6e0bf4a0acdd7@syzkaller.appspotmail.com
> Fixes: 2af89abda7d9 ("io_uring: add option to remove SQ indirection")
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
> ---
>
> diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
> index 300455b4bc12..c53678875416 100644
> --- a/io_uring/fdinfo.c
> +++ b/io_uring/fdinfo.c
> @@ -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;

Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
diff mbox series

Patch

diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
index 300455b4bc12..c53678875416 100644
--- a/io_uring/fdinfo.c
+++ b/io_uring/fdinfo.c
@@ -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;