Skip to content

Commit c5f7191

Browse files
committed
io_uring/rw: always clear ->bytes_done on io_async_rw setup
A previous commit mistakenly moved the clearing of the in-progress byte count into the section that's dependent on having a cached iovec or not, but it should be cleared for any IO. If not, then extra bytes may be added at IO completion time, causing potentially weird behavior like over-reporting the amount of IO done. Fixes: d7f1161 ("io_uring/rw: Allocate async data through helper") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-lkp/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 21adbca commit c5f7191

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/rw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ static int io_rw_alloc_async(struct io_kiocb *req)
228228
kasan_mempool_unpoison_object(rw->free_iovec,
229229
rw->free_iov_nr * sizeof(struct iovec));
230230
req->flags |= REQ_F_NEED_CLEANUP;
231-
rw->bytes_done = 0;
232231
}
232+
rw->bytes_done = 0;
233233
return 0;
234234
}
235235

0 commit comments

Comments
 (0)