summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2026-07-27 03:05:13 -0600
committerJens Axboe <axboe@kernel.dk>2026-07-27 03:05:13 -0600
commit7791570bac6cd0c740fd63568f0f3811bc8ec7ab (patch)
tree399caae032a9076f0293d07a2a3c4cac6e0f06c2 /io_uring
parent03b0bcd2440b4ace0fb4bdf93e444db6454e7370 (diff)
parentbc6d516abfe7085bf706aff22127859f06174f75 (diff)
downloadlinux-next-7791570bac6cd0c740fd63568f0f3811bc8ec7ab.tar.gz
linux-next-7791570bac6cd0c740fd63568f0f3811bc8ec7ab.zip
Merge branch 'io_uring-7.2' into for-next
* io_uring-7.2: io_uring/kbuf: cap buffer selection length at MAX_RW_COUNT io_uring/net: initialize mshot_len for send
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/kbuf.c5
-rw-r--r--io_uring/net.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index de0129bceaba..1cf5be62bb65 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -266,6 +266,9 @@ static int io_ring_buffers_peek(struct io_kiocb *req, struct buf_sel_arg *arg,
if (unlikely(!nr_avail))
return -ENOBUFS;
+ /* MAX_RW_COUNT is the universal Linux per-call IO maximum */
+ arg->max_len = min_t(size_t, arg->max_len, MAX_RW_COUNT);
+
buf = io_ring_head_to_buf(br, head, bl->mask);
if (arg->max_len) {
u32 len = READ_ONCE(buf->len);
@@ -295,7 +298,7 @@ static int io_ring_buffers_peek(struct io_kiocb *req, struct buf_sel_arg *arg,
/* set it to max, if not set, so we can use it unconditionally */
if (!arg->max_len)
- arg->max_len = INT_MAX;
+ arg->max_len = MAX_RW_COUNT;
req->buf_index = READ_ONCE(buf->bid);
do {
diff --git a/io_uring/net.c b/io_uring/net.c
index 00a7df803b99..a74d15f7b7d2 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -445,6 +445,7 @@ int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
req->flags |= REQ_F_NOWAIT;
if (req->flags & REQ_F_BUFFER_SELECT)
sr->buf_group = req->buf_index;
+ sr->mshot_total_len = sr->mshot_len = 0;
if (sr->flags & IORING_RECVSEND_BUNDLE) {
if (req->opcode == IORING_OP_SENDMSG)
return -EINVAL;