Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3516290pxf; Mon, 15 Mar 2021 11:16:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc6X9UORzP4mard9YsoF/yKcRHF8TFaE5GcBw7Nvk/O1sSWpFs/zBmt0Z7twSU7Yd51ccB X-Received: by 2002:aa7:d9c8:: with SMTP id v8mr30829694eds.9.1615832188558; Mon, 15 Mar 2021 11:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832188; cv=none; d=google.com; s=arc-20160816; b=CR52lP7cFiNnLBZr2o8JvXcQex1P+Mi9DDJv2RY4B4RfB+0h7Ye9ikQJuFgvDw81h0 VCMaLvCJy2Ux2HXPvmJE29zZ7TDMOIPw4XtcYxnC4hANrcDqA+irEbQnlwjNGhjladEn r0791cZyefnudUuXpBqp5PkoW23+UNktAJd5sWrRLm6evbvDFYMJFyPRln6IostyYiNU HyTqGx72A//NG+w0u5yM02xnJzuQk8l2ISmlENxT68Pcl80vUZk1qEk3dDSsQjsTlRxl VNOMmeyaayRheXwyT8W+NbgqZoQjHEaWLyVq/xMZl6+um00BI3KsVMMJqZZK4c8eL43a ES/Q== 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=W1wpYHxuVBWAl4UKJTUm//g/hzDMHRjOrSzBpXZqV/s=; b=GHbsAzovh7kXmIIw7NQB34ouUAblCCDrxeKdxfR+nsuvo7nMADOzU++uSFIuTheG9+ JMRvKRdo6he0kAFcXye1XeGrR5rjhNyw66lmKIWrrCDm2Kk10wCwFdwfrhs1/gDcH4HM 0eEAlkyWrTCV1ZUX4ulPi6iH0+uaC6Misdp19w8TvPM6TWa9wfjRf+0C4vkiOlR96kFk vzZYPfRf2PFN6kxLs+yu4LaDlmzt0T+wDqzGxAOojjPYI6LnEp5G2cRrQ3O2pIaU2cEb 3AodiDXJpdVIJphtwneKpi2pLyjEzUJmCtV/YJhHCIm6QqHu6T1wXoLJOHW9IjsRnp2b xelA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LzjwfRD6; 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 z2si2120613eju.371.2021.03.15.11.16.06; Mon, 15 Mar 2021 11:16:28 -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=LzjwfRD6; 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 S236619AbhCOONS (ORCPT + 99 others); Mon, 15 Mar 2021 10:13:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:36622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbhCON7E (ORCPT ); Mon, 15 Mar 2021 09:59:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F78864F13; Mon, 15 Mar 2021 13:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816733; bh=Bmx3KOJBYYoPNczQQuo7vTa/SwT5fCvIwJqqd6fl1Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LzjwfRD6G0Mcvk9uQdMDzm23eQJCZUQJyJp7kl3G1zRwIpkev8OiOvnlcjXCT1qdM bNax3D2EcTH0Sw1NB4RHjQYFpg21HRPuOW/fpomEiV4c912ZP71vhVWVseowXDrHuE ACFnGL4muuU8qqksT/iGg+G5/upx8CAaLzpgxtSQ= 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 4.19 034/120] drm/compat: Clear bounce structures Date: Mon, 15 Mar 2021 14:56:25 +0100 Message-Id: <20210315135721.107312851@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -96,6 +96,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), @@ -134,6 +136,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), @@ -260,6 +265,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, DRM_UNLOCKED); @@ -842,6 +849,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; @@ -879,6 +888,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;