]> git.dujemihanovic.xyz Git - linux.git/commitdiff
io_uring/net: don't pick multiple buffers for non-bundle send
authorJens Axboe <axboe@kernel.dk>
Wed, 7 Aug 2024 21:09:33 +0000 (15:09 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 Aug 2024 21:20:52 +0000 (15:20 -0600)
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: stable@vger.kernel.org
Fixes: a05d1f625c7a ("io_uring/net: support bundles for send")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/net.c

index 050bea5e72569b6890cddadd0007efeb52b18bdd..d08abcca89cc5b7d5c605f56c69e09f8d973f458 100644 (file)
@@ -601,17 +601,18 @@ retry_bundle:
                        .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))