提交 19dfcec1 编写于 作者: A Aleix Roca Nonell 提交者: Joseph Qi

io_uring: fix manual setup of iov_iter for fixed buffers

commit 99c79f6692ccdc42e04deea8a36e22bb48168a62 upstream.

Commit bd11b3a391e3 ("io_uring: don't use iov_iter_advance() for fixed
buffers") introduced an optimization to avoid using the slow
iov_iter_advance by manually populating the iov_iter iterator in some
cases.

However, the computation of the iterator count field was erroneous: The
first bvec was always accounted for an extent of page size even if the
bvec length was smaller.

In consequence, some I/O operations on fixed buffers were unable to
operate on the full extent of the buffer, consistently skipping some
bytes at the end of it.

Fixes: bd11b3a391e3 ("io_uring: don't use iov_iter_advance() for fixed buffers")
Cc: stable@vger.kernel.org
Signed-off-by: NAleix Roca Nonell <aleix.rocanonell@bsc.es>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 5707a64b
......@@ -1096,10 +1096,8 @@ static int io_import_fixed(struct io_ring_ctx *ctx, int rw,
iter->bvec = bvec + seg_skip;
iter->nr_segs -= seg_skip;
iter->count -= (seg_skip << PAGE_SHIFT);
iter->count -= bvec->bv_len + offset;
iter->iov_offset = offset & ~PAGE_MASK;
if (iter->iov_offset)
iter->count -= iter->iov_offset;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册