io_uring: fix 0-iov read buffer select

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: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Pavel Begunkov 2020-12-19 03:15:43 +00:00 committed by Jens Axboe
parent dfea9fce29
commit dd20166236
1 changed files with 1 additions and 3 deletions

View File

@ -3125,9 +3125,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