Skip to content

Commit

Permalink
io_uring/rw: always clear ->bytes_done on io_async_rw setup
Browse files Browse the repository at this point in the history
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 <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202412271132.a09c3500-lkp@intel.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Dec 27, 2024
1 parent 21adbca commit c5f7191
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion io_uring/rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ static int io_rw_alloc_async(struct io_kiocb *req)
kasan_mempool_unpoison_object(rw->free_iovec,
rw->free_iov_nr * sizeof(struct iovec));
req->flags |= REQ_F_NEED_CLEANUP;
rw->bytes_done = 0;
}
rw->bytes_done = 0;
return 0;
}

Expand Down

0 comments on commit c5f7191

Please sign in to comment.