Skip to content

Commit cdd71b7

Browse files
committed
Merge branch 'io_uring-7.0' into for-next
* io_uring-7.0: io_uring/rsrc: reject zero-length fixed buffer import io_uring/net: fix slab-out-of-bounds read in io_bundle_nbufs()
2 parents bd500ea + 111a12b commit cdd71b7

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

io_uring/net.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
425425

426426
sr->done_io = 0;
427427
sr->len = READ_ONCE(sqe->len);
428+
if (unlikely(sr->len < 0))
429+
return -EINVAL;
428430
sr->flags = READ_ONCE(sqe->ioprio);
429431
if (sr->flags & ~SENDMSG_FLAGS)
430432
return -EINVAL;
@@ -795,6 +797,8 @@ int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
795797

796798
sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
797799
sr->len = READ_ONCE(sqe->len);
800+
if (unlikely(sr->len < 0))
801+
return -EINVAL;
798802
sr->flags = READ_ONCE(sqe->ioprio);
799803
if (sr->flags & ~RECVMSG_FLAGS)
800804
return -EINVAL;

io_uring/rsrc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,10 @@ static int io_import_fixed(int ddir, struct iov_iter *iter,
10611061
return ret;
10621062
if (!(imu->dir & (1 << ddir)))
10631063
return -EFAULT;
1064+
if (unlikely(!len)) {
1065+
iov_iter_bvec(iter, ddir, NULL, 0, 0);
1066+
return 0;
1067+
}
10641068

10651069
offset = buf_addr - imu->ubuf;
10661070

0 commit comments

Comments
 (0)