Skip to content

Commit 63b7b3e

Browse files
committed
Merge tag 'io_uring-5.18-2022-04-29' of git://git.kernel.dk/linux-block
Pull io_uring fixes from Jens Axboe: "Pretty boring: - three patches just adding reserved field checks (me, Eugene) - Fixing a potential regression with IOPOLL caused by a block change (Joseph)" Boring is good. * tag 'io_uring-5.18-2022-04-29' of git://git.kernel.dk/linux-block: io_uring: check that data field is 0 in ringfd unregister io_uring: fix uninitialized field in rw io_kiocb io_uring: check reserved fields for recv/recvmsg io_uring: check reserved fields for send/sendmsg
2 parents bdda830 + 303cc74 commit 63b7b3e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/io_uring.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3783,6 +3783,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
37833783
if (!(kiocb->ki_flags & IOCB_DIRECT) || !file->f_op->iopoll)
37843784
return -EOPNOTSUPP;
37853785

3786+
kiocb->private = NULL;
37863787
kiocb->ki_flags |= IOCB_HIPRI | IOCB_ALLOC_CACHE;
37873788
kiocb->ki_complete = io_complete_rw_iopoll;
37883789
req->iopoll_completed = 0;
@@ -5207,6 +5208,8 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
52075208

52085209
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
52095210
return -EINVAL;
5211+
if (unlikely(sqe->addr2 || sqe->file_index))
5212+
return -EINVAL;
52105213

52115214
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
52125215
sr->len = READ_ONCE(sqe->len);
@@ -5418,6 +5421,8 @@ static int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
54185421

54195422
if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
54205423
return -EINVAL;
5424+
if (unlikely(sqe->addr2 || sqe->file_index))
5425+
return -EINVAL;
54215426

54225427
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
54235428
sr->len = READ_ONCE(sqe->len);
@@ -10588,7 +10593,7 @@ static int io_ringfd_unregister(struct io_ring_ctx *ctx, void __user *__arg,
1058810593
ret = -EFAULT;
1058910594
break;
1059010595
}
10591-
if (reg.resv || reg.offset >= IO_RINGFD_REG_MAX) {
10596+
if (reg.resv || reg.data || reg.offset >= IO_RINGFD_REG_MAX) {
1059210597
ret = -EINVAL;
1059310598
break;
1059410599
}

0 commit comments

Comments
 (0)