public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring/rw: always clear ->bytes_done on io_async_rw setup
@ 2024-12-27 16:53 Jens Axboe
  2024-12-30 16:08 ` Gabriel Krisman Bertazi
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2024-12-27 16:53 UTC (permalink / raw)
  To: io-uring; +Cc: Gabriel Krisman Bertazi

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: f628c7e5a7c0 ("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]>

---

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;
 }
 
-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-31  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-27 16:53 [PATCH] io_uring/rw: always clear ->bytes_done on io_async_rw setup Jens Axboe
2024-12-30 16:08 ` Gabriel Krisman Bertazi
2024-12-30 16:58   ` Jens Axboe
2024-12-30 23:02     ` Gabriel Krisman Bertazi
2024-12-31  0:13       ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox