Commit 8828729c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'io_uring-6.11-20240809' of git://git.kernel.dk/linux

Pull io_uring fixes from Jens Axboe:
 "Nothing major in here, just two fixes for ensuring that bundle
  recv/send requests always get marked for cleanups, and a single fix to
  ensure that sends with provided buffers only pick a single buffer
  unless the bundle option has been enabled"

* tag 'io_uring-6.11-20240809' of git://git.kernel.dk/linux:
  io_uring/net: don't pick multiple buffers for non-bundle send
  io_uring/net: ensure expanded bundle send gets marked for cleanup
  io_uring/net: ensure expanded bundle recv gets marked for cleanup
parents 377773dd 8fe8ac24
...@@ -601,17 +601,18 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags) ...@@ -601,17 +601,18 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
.iovs = &kmsg->fast_iov, .iovs = &kmsg->fast_iov,
.max_len = INT_MAX, .max_len = INT_MAX,
.nr_iovs = 1, .nr_iovs = 1,
.mode = KBUF_MODE_EXPAND,
}; };
if (kmsg->free_iov) { if (kmsg->free_iov) {
arg.nr_iovs = kmsg->free_iov_nr; arg.nr_iovs = kmsg->free_iov_nr;
arg.iovs = kmsg->free_iov; arg.iovs = kmsg->free_iov;
arg.mode |= KBUF_MODE_FREE; arg.mode = KBUF_MODE_FREE;
} }
if (!(sr->flags & IORING_RECVSEND_BUNDLE)) if (!(sr->flags & IORING_RECVSEND_BUNDLE))
arg.nr_iovs = 1; arg.nr_iovs = 1;
else
arg.mode |= KBUF_MODE_EXPAND;
ret = io_buffers_select(req, &arg, issue_flags); ret = io_buffers_select(req, &arg, issue_flags);
if (unlikely(ret < 0)) if (unlikely(ret < 0))
...@@ -623,6 +624,7 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags) ...@@ -623,6 +624,7 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
if (arg.iovs != &kmsg->fast_iov && arg.iovs != kmsg->free_iov) { if (arg.iovs != &kmsg->fast_iov && arg.iovs != kmsg->free_iov) {
kmsg->free_iov_nr = ret; kmsg->free_iov_nr = ret;
kmsg->free_iov = arg.iovs; kmsg->free_iov = arg.iovs;
req->flags |= REQ_F_NEED_CLEANUP;
} }
} }
...@@ -1094,6 +1096,7 @@ static int io_recv_buf_select(struct io_kiocb *req, struct io_async_msghdr *kmsg ...@@ -1094,6 +1096,7 @@ static int io_recv_buf_select(struct io_kiocb *req, struct io_async_msghdr *kmsg
if (arg.iovs != &kmsg->fast_iov && arg.iovs != kmsg->free_iov) { if (arg.iovs != &kmsg->fast_iov && arg.iovs != kmsg->free_iov) {
kmsg->free_iov_nr = ret; kmsg->free_iov_nr = ret;
kmsg->free_iov = arg.iovs; kmsg->free_iov = arg.iovs;
req->flags |= REQ_F_NEED_CLEANUP;
} }
} else { } else {
void __user *buf; void __user *buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment