Skip to content
/ linux Public

Commit f98405a

Browse files
axboegregkh
authored andcommitted
io_uring/kbuf: fix missing BUF_MORE for incremental buffers at EOF
commit 3ecd3e0 upstream. For a zero length transfer, io_kbuf_inc_commit() is called with !len. Since we never enter the while loop to consume the buffers, io_kbuf_inc_commit() ends up returning true, consuming the buffer. But if no data was consumed, by definition it cannot have consumed the buffer. Return false for that case. Reported-by: Martin Michaelis <code@mgjm.de> Cc: stable@vger.kernel.org Fixes: ae98dbf ("io_uring/kbuf: add support for incremental buffer consumption") Link: axboe/liburing#1553 Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0f4ce79 commit f98405a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

io_uring/kbuf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ struct io_provide_buf {
3434

3535
static bool io_kbuf_inc_commit(struct io_buffer_list *bl, int len)
3636
{
37+
/* No data consumed, return false early to avoid consuming the buffer */
38+
if (!len)
39+
return false;
40+
3741
while (len) {
3842
struct io_uring_buf *buf;
3943
u32 buf_len, this_len;

0 commit comments

Comments
 (0)