]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
io_uring/kbuf: propagate BUF_MORE through early buffer commit path
authorJens Axboe <axboe@kernel.dk>
Thu, 19 Mar 2026 20:29:20 +0000 (14:29 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:49 +0000 (11:08 +0100)
commit0866809dfe19d22470ce76c749e0ac479b94e95e
tree403f0a53c5b0f54f17deecd18465aa1ef6b44225
parent04d57b332e37ba0052c5062b3f86e871fee6e436
io_uring/kbuf: propagate BUF_MORE through early buffer commit path

Commit 418eab7a6f3c002d8e64d6e95ec27118017019af upstream.

When io_should_commit() returns true (eg for non-pollable files), buffer
commit happens at buffer selection time and sel->buf_list is set to
NULL. When __io_put_kbufs() generates CQE flags at completion time, it
calls __io_put_kbuf_ring() which finds a NULL buffer_list and hence
cannot determine whether the buffer was consumed or not. This means that
IORING_CQE_F_BUF_MORE is never set for non-pollable input with
incrementally consumed buffers.

Likewise for io_buffers_select(), which always commits upfront and
discards the return value of io_kbuf_commit().

Add REQ_F_BUF_MORE to store the result of io_kbuf_commit() during early
commit. Then __io_put_kbuf_ring() can check this flag and set
IORING_F_BUF_MORE accordingy.

Reported-by: Martin Michaelis <code@mgjm.de>
Cc: stable@vger.kernel.org
Fixes: ae98dbf43d75 ("io_uring/kbuf: add support for incremental buffer consumption")
Link: https://github.com/axboe/liburing/issues/1553
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/io_uring_types.h
io_uring/kbuf.c
io_uring/kbuf.h