Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3517183pxf; Mon, 15 Mar 2021 11:17:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcwU0T/u6aL9g5tFP2K2Cm7nn+FaTLbPkSJAUy/XLGLPHTjIvMaTUB66/qhjxeckUno5l4 X-Received: by 2002:a05:6402:1350:: with SMTP id y16mr31367401edw.309.1615832269232; Mon, 15 Mar 2021 11:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832269; cv=none; d=google.com; s=arc-20160816; b=I3J/f0u8GyJUrpind7nXCYlHgxk/2thG/kxjhaRS4PRM53x/1NkrGFp/2BBqT5bPSJ ZVPTN85O7GphCEtZ2TBdA0Vk5XuQThfsdSnl/k6Q2J+4VfJDRE2IrXz7kPqnGYrGch51 vOrAVtbfj/wT2aGTXwc3q9pxlQ5wjaEWzkQJoS38GgNjfXN6KKBfg7k9c5mUGpyU/TY+ CVpmafp2OSdgGOOVOMNx3z+aIuMy+mx33Osf5buKnl1ZYY0jW8MjpvWaFONonJTTS0CM /G9kduUHYN0SIhAt2lOqdZATOOsFJqii198hWH9fNttvIiNpNEObYRGt2UnAOEqfxk0D Ozyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ghcjVMPxpWaC7ot6KQtMX5psEuAyzW91Wnv90jhIysw=; b=Rb1Q+RAmLVowoJvvGh8+g1yccupSXUDA42iAT8qI+OdaTkraZVT4TQVQsJDoTKMahA tEvyrYKI/Zuu49mfuEeDd+uTQ82crnfQnH3rFEj8PS/ZODm2mVB41bReBopjVuJQutjK BRPTGqrMN5QT6Y8gA1DLVY7LRrv0R5vPg8swBcZ/nqfIaKZKAlI3NfRxpqtcep1lelFU ihs07uHYHLEVtvgZ0QKQRiHc/SuxMqeXOYLxssGHdLqr9ocVdve03pUZ1AnADY6lw7n0 p60TFhtZdCamK8+lEdmLKjLKza1U0hQv7I6YqZnQs6Kl7KUTvJbC1AmsHMGe+ruh4pBB SgWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XgnswB4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx21si11639077ejc.503.2021.03.15.11.17.26; Mon, 15 Mar 2021 11:17:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XgnswB4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236846AbhCOOQu (ORCPT + 99 others); Mon, 15 Mar 2021 10:16:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:36764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232617AbhCON7R (ORCPT ); Mon, 15 Mar 2021 09:59:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD1D864EF9; Mon, 15 Mar 2021 13:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816737; bh=gRKwgZktH4u+F9jk1fBKe/Bz8H5BM0x3BycRYvJZzgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgnswB4TXpLUEdr413g0UxIiHGfQSjU4uM1pemYl4i8NvhNKdauRXQVVn68SNJCaF 8TqQPr2R2PEdGvUzF5RXms4IqAsX6nN41AyABfT22fMESBMmElBgw3K47LOzDDiDxL gN+QTTFnwVkIQJ2T2i76kQ7ZJdijtUDf04a1QIfw= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , syzbot+620cf21140fc7e772a5d@syzkaller.appspotmail.com, Daniel Vetter , Maarten Lankhorst Subject: [PATCH 5.10 084/290] drm/compat: Clear bounce structures Date: Mon, 15 Mar 2021 14:52:57 +0100 Message-Id: <20210315135544.762265261@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Daniel Vetter commit de066e116306baf3a6a62691ac63cfc0b1dabddb upstream. Some of them have gaps, or fields we don't clear. Native ioctl code does full copies plus zero-extends on size mismatch, so nothing can leak. But compat is more hand-rolled so need to be careful. None of these matter for performance, so just memset. Also I didn't fix up the CONFIG_DRM_LEGACY or CONFIG_DRM_AGP ioctl, those are security holes anyway. Acked-by: Maxime Ripard Reported-by: syzbot+620cf21140fc7e772a5d@syzkaller.appspotmail.com # vblank ioctl Cc: syzbot+620cf21140fc7e772a5d@syzkaller.appspotmail.com Cc: stable@vger.kernel.org Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20210222100643.400935-1-daniel.vetter@ffwll.ch (cherry picked from commit e926c474ebee404441c838d18224cd6f246a71b7) Signed-off-by: Maarten Lankhorst Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_ioc32.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c @@ -99,6 +99,8 @@ static int compat_drm_version(struct fil if (copy_from_user(&v32, (void __user *)arg, sizeof(v32))) return -EFAULT; + memset(&v, 0, sizeof(v)); + v = (struct drm_version) { .name_len = v32.name_len, .name = compat_ptr(v32.name), @@ -137,6 +139,9 @@ static int compat_drm_getunique(struct f if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32))) return -EFAULT; + + memset(&uq, 0, sizeof(uq)); + uq = (struct drm_unique){ .unique_len = uq32.unique_len, .unique = compat_ptr(uq32.unique), @@ -265,6 +270,8 @@ static int compat_drm_getclient(struct f if (copy_from_user(&c32, argp, sizeof(c32))) return -EFAULT; + memset(&client, 0, sizeof(client)); + client.idx = c32.idx; err = drm_ioctl_kernel(file, drm_getclient, &client, 0); @@ -852,6 +859,8 @@ static int compat_drm_wait_vblank(struct if (copy_from_user(&req32, argp, sizeof(req32))) return -EFAULT; + memset(&req, 0, sizeof(req)); + req.request.type = req32.request.type; req.request.sequence = req32.request.sequence; req.request.signal = req32.request.signal; @@ -889,6 +898,8 @@ static int compat_drm_mode_addfb2(struct struct drm_mode_fb_cmd2 req64; int err; + memset(&req64, 0, sizeof(req64)); + if (copy_from_user(&req64, argp, offsetof(drm_mode_fb_cmd232_t, modifier))) return -EFAULT;