Skip to content

Commit c0921e5

Browse files
wlukowiczaxboe
authored andcommitted
io_uring: fix return value when removing provided buffers
When a request to remove buffers is submitted, and the given number to be removed is larger than available in the specified buffer group, the resulting CQE result will be the number of removed buffers + 1, which is 1 more than it should be. Previously, the head was part of the list and it got removed after the loop, so the increment was needed. Now, the head is not an element of the list, so the increment shouldn't be there anymore. Fixes: dbc7d45 ("io_uring: manage provided buffers strictly ordered") Signed-off-by: Wojciech Lukowicz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent fd30d1c commit c0921e5

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

io_uring/kbuf.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ static int __io_remove_buffers(struct io_ring_ctx *ctx,
228228
return i;
229229
}
230230

231-
/* the head kbuf is the list itself */
232231
while (!list_empty(&bl->buf_list)) {
233232
struct io_buffer *nxt;
234233

@@ -238,7 +237,6 @@ static int __io_remove_buffers(struct io_ring_ctx *ctx,
238237
return i;
239238
cond_resched();
240239
}
241-
i++;
242240

243241
return i;
244242
}

0 commit comments

Comments
 (0)