From e3bb847cc46cfe70e4e45834eba426b2449d79e3 Mon Sep 17 00:00:00 2001 From: Pavel Begunkov Date: Thu, 7 Jan 2021 07:45:06 +0000 Subject: [PATCH] io_uring: fix 0-iov read buffer select stable inclusion from stable-5.10.4 commit 72a016d42d3611ee13eb1e0c943b7397f21f7b62 bugzilla: 46903 -------------------------------- commit dd20166236953c8cd14f4c668bf972af32f0c6be upstream. Doing vectored buf-select read with 0 iovec passed is meaningless and utterly broken, forbid it. Cc: # 5.7+ Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Signed-off-by: Chen Jun Acked-by: Xie XiuQi --- fs/io_uring.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index c422f255b51b..797874f215b1 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3048,9 +3048,7 @@ static ssize_t io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov, iov[0].iov_len = kbuf->len; return 0; } - if (!req->rw.len) - return 0; - else if (req->rw.len > 1) + if (req->rw.len != 1) return -EINVAL; #ifdef CONFIG_COMPAT -- GitLab