Skip to content

Commit d07ba8a

Browse files
committed
io_uring/nop: ensure nop->fd is always initialized
JIRA: https://issues.redhat.com/browse/RHEL-105612 commit ee11657 Author: Jens Axboe <axboe@kernel.dk> Date: Thu Nov 21 07:12:17 2024 -0700 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> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
1 parent 660b34c commit d07ba8a

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
@@ -36,10 +36,14 @@ int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
3636
nop->result = READ_ONCE(sqe->len);
3737
else
3838
nop->result = 0;
39-
if (nop->flags & IORING_NOP_FIXED_FILE)
39+
if (nop->flags & IORING_NOP_FILE)
4040
nop->fd = READ_ONCE(sqe->fd);
41+
else
42+
nop->fd = -1;
4143
if (nop->flags & IORING_NOP_FIXED_BUFFER)
4244
nop->buffer = READ_ONCE(sqe->buf_index);
45+
else
46+
nop->buffer = -1;
4347
return 0;
4448
}
4549

0 commit comments

Comments
 (0)