From: Pavel Begunkov Date: Sun, 29 Nov 2020 18:33:32 +0000 (+0000) Subject: io_uring: fix recvmsg setup with compat buf-select X-Git-Tag: v5.10.7~1014^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d280bc8930ba9ed1705cfd548c6c8924949eaf1;p=platform%2Fkernel%2Flinux-rpi.git io_uring: fix recvmsg setup with compat buf-select __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: # 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 1023f7b..a2a7c65 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4499,7 +4499,8 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req, 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 = __import_iovec(READ, (struct iovec __user *)uiov, len,