| From | Greg Kroah-Hartman <> | Subject | [PATCH 5.9 42/75] io_uring: fix recvmsg setup with compat buf-select | Date | Thu, 10 Dec 2020 15:27:07 +0100 |
| |
From: Pavel Begunkov <asml.silence@gmail.com>
commit 2d280bc8930ba9ed1705cfd548c6c8924949eaf1 upstream.
__io_compat_recvmsg_copy_hdr() with REQ_F_BUFFER_SELECT reads out iov len but never assigns it to iov/fast_iov, leaving sr->len with garbage. Hopefully, following io_buffer_select() truncates it to the selected buffer size, but the value is still may be under what was specified.
Cc: <stable@vger.kernel.org> # 5.7 Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--- fs/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
--- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4300,7 +4300,8 @@ static int __io_compat_recvmsg_copy_hdr( return -EFAULT; if (clen < 0) return -EINVAL; - sr->len = iomsg->iov[0].iov_len; + sr->len = clen; + iomsg->iov[0].iov_len = clen; iomsg->iov = NULL; } else { ret = compat_import_iovec(READ, uiov, len, UIO_FASTIOV,
|