diff --git a/fs/io_uring.c b/fs/io_uring.c index 49c7cd8380e8933f49df4d897cd4ac68c687e9f6..b124f1df56deeba5e6388ff3ca0e1cdac9c37257 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2363,6 +2363,7 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req, *iovec = NULL; return PTR_ERR(buf); } + req->rw.len = sqe_len; } ret = import_single_range(rw, buf, sqe_len, *iovec, iter); @@ -2382,8 +2383,10 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req, if (req->flags & REQ_F_BUFFER_SELECT) { ret = io_iov_buffer_select(req, *iovec, needs_lock); - if (!ret) - iov_iter_init(iter, rw, *iovec, 1, (*iovec)->iov_len); + if (!ret) { + ret = (*iovec)->iov_len; + iov_iter_init(iter, rw, *iovec, 1, ret); + } *iovec = NULL; return ret; }