Commit c183edff authored by Jens Axboe's avatar Jens Axboe

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: ff6165b2 ("io_uring: retain iov_iter state over io_read/io_write calls")
Reported-by: default avatarNick Hill <nick@nickhill.org>
Tested-by: default avatarNorman Maurer <norman.maurer@googlemail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 355afaeb
...@@ -2980,14 +2980,15 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw, ...@@ -2980,14 +2980,15 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw,
bool force_nonblock) bool force_nonblock)
{ {
struct io_async_rw *iorw = &req->io->rw; struct io_async_rw *iorw = &req->io->rw;
struct iovec *iov;
ssize_t ret; ssize_t ret;
iorw->iter.iov = iorw->fast_iov; iorw->iter.iov = iov = iorw->fast_iov;
ret = __io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov, ret = __io_import_iovec(rw, req, &iov, &iorw->iter, !force_nonblock);
&iorw->iter, !force_nonblock);
if (unlikely(ret < 0)) if (unlikely(ret < 0))
return ret; return ret;
iorw->iter.iov = iov;
io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter); io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment