From: Pavel Begunkov Date: Sat, 19 Dec 2020 03:15:43 +0000 (+0000) Subject: io_uring: fix 0-iov read buffer select X-Git-Tag: accepted/tizen/unified/20230118.172025~8175^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd20166236953c8cd14f4c668bf972af32f0c6be;p=platform%2Fkernel%2Flinux-rpi.git 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: # 5.7+ Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index b749578..f3690df 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3125,9 +3125,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