提交 e3bb847c 编写于 作者: P Pavel Begunkov 提交者: Xie XiuQi

io_uring: fix 0-iov read buffer select

stable inclusion
from stable-5.10.4
commit 72a016d42d3611ee13eb1e0c943b7397f21f7b62
bugzilla: 46903

--------------------------------

commit dd201662 upstream.

Doing vectored buf-select read with 0 iovec passed is meaningless and
utterly broken, forbid it.

Cc: <stable@vger.kernel.org> # 5.7+
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 3d4e5ed3
...@@ -3048,9 +3048,7 @@ static ssize_t io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov, ...@@ -3048,9 +3048,7 @@ static ssize_t io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov,
iov[0].iov_len = kbuf->len; iov[0].iov_len = kbuf->len;
return 0; return 0;
} }
if (!req->rw.len) if (req->rw.len != 1)
return 0;
else if (req->rw.len > 1)
return -EINVAL; return -EINVAL;
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册