Skip to content

Commit c183edf

Browse files
committed
io_uring: fix explicit async read/write mapping for large segments
If we exceed UIO_FASTIOV, we don't handle the transition correctly between an allocated vec for requests that are queued with IOSQE_ASYNC. Store the iovec appropriately and re-set it in the iter iov in case it changed. Fixes: ff6165b ("io_uring: retain iov_iter state over io_read/io_write calls") Reported-by: Nick Hill <nick@nickhill.org> Tested-by: Norman Maurer <norman.maurer@googlemail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 355afae commit c183edf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/io_uring.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,14 +2980,15 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw,
29802980
bool force_nonblock)
29812981
{
29822982
struct io_async_rw *iorw = &req->io->rw;
2983+
struct iovec *iov;
29832984
ssize_t ret;
29842985

2985-
iorw->iter.iov = iorw->fast_iov;
2986-
ret = __io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov,
2987-
&iorw->iter, !force_nonblock);
2986+
iorw->iter.iov = iov = iorw->fast_iov;
2987+
ret = __io_import_iovec(rw, req, &iov, &iorw->iter, !force_nonblock);
29882988
if (unlikely(ret < 0))
29892989
return ret;
29902990

2991+
iorw->iter.iov = iov;
29912992
io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter);
29922993
return 0;
29932994
}

0 commit comments

Comments
 (0)