public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 0/3] send/recv bundle fixes
@ 2024-08-08  1:47 Jens Axboe
  2024-08-08  1:47 ` [PATCH 1/3] io_uring/net: ensure expanded bundle recv gets marked for cleanup Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jens Axboe @ 2024-08-08  1:47 UTC (permalink / raw)
  To: io-uring

Hi,

Just three minor fixes for 6.11, all marked for stable as well. Two
of them fix a missing REQ_F_NEED_CLEANUP being set for recv and send,
and the last one fixes non-bundle sends potentially picking more than
one buffer. Only bundle sends should do that.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] io_uring/net: ensure expanded bundle recv gets marked for cleanup
  2024-08-08  1:47 [PATCH 0/3] send/recv bundle fixes Jens Axboe
@ 2024-08-08  1:47 ` Jens Axboe
  2024-08-08  1:47 ` [PATCH 2/3] io_uring/net: ensure expanded bundle send " Jens Axboe
  2024-08-08  1:47 ` [PATCH 3/3] io_uring/net: don't pick multiple buffers for non-bundle send Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2024-08-08  1:47 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, stable

If the iovec inside the kmsg isn't already allocated AND one gets
expanded beyond the fixed size, then the request may not already have
been marked for cleanup. Ensure that it is.

Cc: [email protected]
Fixes: 2f9c9515bdfd ("io_uring/net: support bundles for recv")
Signed-off-by: Jens Axboe <[email protected]>
---
 io_uring/net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/io_uring/net.c b/io_uring/net.c
index 594490a1389b..97a48408cec3 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1094,6 +1094,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) {
 			kmsg->free_iov_nr = ret;
 			kmsg->free_iov = arg.iovs;
+			req->flags |= REQ_F_NEED_CLEANUP;
 		}
 	} else {
 		void __user *buf;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] io_uring/net: ensure expanded bundle send gets marked for cleanup
  2024-08-08  1:47 [PATCH 0/3] send/recv bundle fixes Jens Axboe
  2024-08-08  1:47 ` [PATCH 1/3] io_uring/net: ensure expanded bundle recv gets marked for cleanup Jens Axboe
@ 2024-08-08  1:47 ` Jens Axboe
  2024-08-08  1:47 ` [PATCH 3/3] io_uring/net: don't pick multiple buffers for non-bundle send Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2024-08-08  1:47 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, stable

If the iovec inside the kmsg isn't already allocated AND one gets
expanded beyond the fixed size, then the request may not already have
been marked for cleanup. Ensure that it is.

Cc: [email protected]
Fixes: a05d1f625c7a ("io_uring/net: support bundles for send")
Signed-off-by: Jens Axboe <[email protected]>
---
 io_uring/net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/io_uring/net.c b/io_uring/net.c
index 97a48408cec3..050bea5e7256 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -623,6 +623,7 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
 		if (arg.iovs != &kmsg->fast_iov && arg.iovs != kmsg->free_iov) {
 			kmsg->free_iov_nr = ret;
 			kmsg->free_iov = arg.iovs;
+			req->flags |= REQ_F_NEED_CLEANUP;
 		}
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] io_uring/net: don't pick multiple buffers for non-bundle send
  2024-08-08  1:47 [PATCH 0/3] send/recv bundle fixes Jens Axboe
  2024-08-08  1:47 ` [PATCH 1/3] io_uring/net: ensure expanded bundle recv gets marked for cleanup Jens Axboe
  2024-08-08  1:47 ` [PATCH 2/3] io_uring/net: ensure expanded bundle send " Jens Axboe
@ 2024-08-08  1:47 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2024-08-08  1:47 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, stable

If a send is issued marked with IOSQE_BUFFER_SELECT for selecting a
buffer, unless it's a bundle, it should not select multiple buffers.

Cc: [email protected]
Fixes: a05d1f625c7a ("io_uring/net: support bundles for send")
Signed-off-by: Jens Axboe <[email protected]>
---
 io_uring/net.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 050bea5e7256..d08abcca89cc 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -601,17 +601,18 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
 			.iovs = &kmsg->fast_iov,
 			.max_len = INT_MAX,
 			.nr_iovs = 1,
-			.mode = KBUF_MODE_EXPAND,
 		};
 
 		if (kmsg->free_iov) {
 			arg.nr_iovs = kmsg->free_iov_nr;
 			arg.iovs = kmsg->free_iov;
-			arg.mode |= KBUF_MODE_FREE;
+			arg.mode = KBUF_MODE_FREE;
 		}
 
 		if (!(sr->flags & IORING_RECVSEND_BUNDLE))
 			arg.nr_iovs = 1;
+		else
+			arg.mode |= KBUF_MODE_EXPAND;
 
 		ret = io_buffers_select(req, &arg, issue_flags);
 		if (unlikely(ret < 0))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-08  1:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08  1:47 [PATCH 0/3] send/recv bundle fixes Jens Axboe
2024-08-08  1:47 ` [PATCH 1/3] io_uring/net: ensure expanded bundle recv gets marked for cleanup Jens Axboe
2024-08-08  1:47 ` [PATCH 2/3] io_uring/net: ensure expanded bundle send " Jens Axboe
2024-08-08  1:47 ` [PATCH 3/3] io_uring/net: don't pick multiple buffers for non-bundle send Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox