]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
io_uring/kbuf: don't truncate end buffer for bundles
authorJens Axboe <axboe@kernel.dk>
Sun, 7 Jun 2026 22:05:47 +0000 (16:05 -0600)
committerJens Axboe <axboe@kernel.dk>
Sun, 7 Jun 2026 22:11:47 +0000 (16:11 -0600)
commit70f4886bcbb929e88038c8807f1daf7fc587ae7c
treeaff989dd92b5ac51ef716fd60d597ad54f9288bf
parented46f39c47eb5530a9c161481a2080d3a869cfaf
io_uring/kbuf: don't truncate end buffer for bundles

If buffers have been peeked for a bundle receive, the kernel will
truncate the end buffer, if the available length is shorter than the
buffer itself. This is unnecessary, as applications iterating bundle
receives must always use the minimum size of the buffer length and the
remaining number of bytes in the bundle. The examples in liburing do
that as well, eg examples/proxy.c.

If the kernel does truncate this buffer AND the current transfer fails,
then the buffer will be left with a smaller size than what is otherwise
available.

Just remove the buffer truncation, as it's not necessary in the first
place.

Link: https://lore.kernel.org/io-uring/CAAEr8jbY60noGj1fw_k91UJRBkyiRVoS6=nLhZ7Svwidjn4CAA@mail.gmail.com/
Reported-by: Federico Brasili <federico.brasili@gmail.com>
Cc: stable@vger.kernel.org
Fixes: 35c8711c8fc4 ("io_uring/kbuf: add helpers for getting/peeking multiple buffers")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/kbuf.c