Skip to content

Commit ee11657

Browse files
committed
io_uring/nop: ensure nop->fd is always initialized
A previous commit added file support for nop, but it only initializes nop->fd if IORING_NOP_FIXED_FILE is set. That check should be IORING_NOP_FILE. Fix up the condition in nop preparation, and initialize it to a sane value even if we're not going to be directly using it. While in there, do the same thing for the nop->buffer field. Reported-by: syzbot+9a8500a45c2cabdf9577@syzkaller.appspotmail.com Fixes: a85f310 ("io_uring/nop: add support for testing registered files and buffers") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f46b9cd commit ee11657

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

io_uring/nop.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
3535
nop->result = READ_ONCE(sqe->len);
3636
else
3737
nop->result = 0;
38-
if (nop->flags & IORING_NOP_FIXED_FILE)
38+
if (nop->flags & IORING_NOP_FILE)
3939
nop->fd = READ_ONCE(sqe->fd);
40+
else
41+
nop->fd = -1;
4042
if (nop->flags & IORING_NOP_FIXED_BUFFER)
4143
nop->buffer = READ_ONCE(sqe->buf_index);
44+
else
45+
nop->buffer = -1;
4246
return 0;
4347
}
4448

0 commit comments

Comments
 (0)