Skip to content

Commit 5e92936

Browse files
committed
io_uring: terminate manual loop iterator loop correctly for non-vecs
The fix for not advancing the iterator if we're using fixed buffers is broken in that it can hit a condition where we don't terminate the loop. This results in io-wq looping forever, asking to read (or write) 0 bytes for every subsequent loop. Reported-by: Joel Jaeschke <joel.jaeschke@gmail.com> Link: axboe/liburing#549 Fixes: 16c8d2d ("io_uring: ensure symmetry in handling iter types in loop_rw_iter()") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent adf3a9e commit 5e92936

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

fs/io_uring.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,13 +3612,15 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter)
36123612
ret = nr;
36133613
break;
36143614
}
3615+
ret += nr;
36153616
if (!iov_iter_is_bvec(iter)) {
36163617
iov_iter_advance(iter, nr);
36173618
} else {
3618-
req->rw.len -= nr;
36193619
req->rw.addr += nr;
3620+
req->rw.len -= nr;
3621+
if (!req->rw.len)
3622+
break;
36203623
}
3621-
ret += nr;
36223624
if (nr != iovec.iov_len)
36233625
break;
36243626
}

0 commit comments

Comments
 (0)