Skip to content

Commit 641a681

Browse files
committed
Revert "io_uring: Require zeroed sqe->len on provided-buffers send"
This reverts commit 79996b4. Revert the change that restricts a send provided buffer to be zero, so it will always consume the whole buffer. This is strictly needed for partial consumption, as the send may very well be a subset of the current buffer. In fact, that's the intended use case. For non-incremental provided buffer rings, an application should set sqe->len carefully to avoid the potential issue described in the reverted commit. It is recommended that '0' still be set for len for that case, if the application is set on maintaining more than 1 send inflight for the same socket. This is somewhat of a nonsensical thing to do. Signed-off-by: Jens Axboe <[email protected]>
1 parent 2c8fa70 commit 641a681

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

io_uring/net.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,6 @@ int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
434434
sr->buf_group = req->buf_index;
435435
req->buf_list = NULL;
436436
}
437-
if (req->flags & REQ_F_BUFFER_SELECT && sr->len)
438-
return -EINVAL;
439437

440438
#ifdef CONFIG_COMPAT
441439
if (req->ctx->compat)
@@ -599,7 +597,7 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
599597
if (io_do_buffer_select(req)) {
600598
struct buf_sel_arg arg = {
601599
.iovs = &kmsg->fast_iov,
602-
.max_len = INT_MAX,
600+
.max_len = min_not_zero(sr->len, INT_MAX),
603601
.nr_iovs = 1,
604602
};
605603

0 commit comments

Comments
 (0)