Skip to content

Commit 07204f2

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix EIOCBQUEUED iter revert
iov_iter_revert() is done in completion handlers that happensf before read/write returns -EIOCBQUEUED, no need to repeat reverting afterwards. Moreover, even though it may appear being just a no-op, it's actually races with 1) user forging a new iovec of a different size 2) reissue, that is done via io-wq continues completely asynchronously. Fixes: 3e6a0d3 ("io_uring: fix -EAGAIN retry with IOPOLL") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 696ee88 commit 07204f2

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

fs/io_uring.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3284,8 +3284,6 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags)
32843284
ret = io_iter_do_read(req, iter);
32853285

32863286
if (ret == -EIOCBQUEUED) {
3287-
if (req->async_data)
3288-
iov_iter_revert(iter, io_size - iov_iter_count(iter));
32893287
goto out_free;
32903288
} else if (ret == -EAGAIN) {
32913289
/* IOPOLL retry should happen for io-wq threads */
@@ -3418,8 +3416,6 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
34183416
/* no retry on NONBLOCK nor RWF_NOWAIT */
34193417
if (ret2 == -EAGAIN && (req->flags & REQ_F_NOWAIT))
34203418
goto done;
3421-
if (ret2 == -EIOCBQUEUED && req->async_data)
3422-
iov_iter_revert(iter, io_size - iov_iter_count(iter));
34233419
if (!force_nonblock || ret2 != -EAGAIN) {
34243420
/* IOPOLL retry should happen for io-wq threads */
34253421
if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN)

0 commit comments

Comments
 (0)