io_uring/fdinfo: only print ->sq_array[] if it's there
authorJens Axboe <axboe@kernel.dk>
Fri, 1 Sep 2023 19:59:19 +0000 (13:59 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 1 Sep 2023 21:08:29 +0000 (15:08 -0600)
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")
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/fdinfo.c

index 300455b..c536788 100644 (file)
@@ -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;