summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-12-27 09:49:32 -0700
committerJens Axboe <axboe@kernel.dk>2024-12-27 10:09:34 -0700
commitc5f71916146033f9aba108075ff7087022075fd6 (patch)
treed927ead0550a7fcc18b967413796d224714b5431
parent21adbcaa8007f5e584d26bebb46ec46bfbbbd330 (diff)
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: d7f11616edf5 ("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>
-rw-r--r--io_uring/rw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 75f70935ccf4..ca1b19d3d142 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -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;
}