Skip to content

Commit da921fa

Browse files
author
Ming Lei
committed
io_uring/nop: ensure nop->fd is always initialized
JIRA: https://issues.redhat.com/browse/RHEL-106845 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: Ming Lei <ming.lei@redhat.com>
1 parent 02c1386 commit da921fa

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)