Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3818130ybl; Mon, 13 Jan 2020 03:12:00 -0800 (PST) X-Google-Smtp-Source: APXvYqxWiHgr5IRrc6XDooxU6JEpNzng8W+AEOtpBW3FPM2jfW5Y4MWAdteef479bEdJIy7jROlh X-Received: by 2002:a05:6808:244:: with SMTP id m4mr12431927oie.125.1578913920865; Mon, 13 Jan 2020 03:12:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578913920; cv=none; d=google.com; s=arc-20160816; b=wpDvTFqPcPl14/fdGi83qiqaZMFFRJIxlZaeiHMDtEoK+92cWP2qMgpvfqAxbMzt1U uKXvVPqjP79bA1tynvJcOVDCL38tu5z21PpC8kHCb50d38CiZ5edDKMXB7zVZW4H0x/c rMb5Mqq4wNuHz+E/NVc4GWBVhQFJAVrY/w8nVXVRAxXPq+RqQOKsxaN0UateJAEgK3Kz cVSbNxu5U4cLAEXqAqeiGuGlE+jDlzsy3ZriWQSAEGUxXhWx5buLDfmUTGoMZcTm5Rh4 EUfT56ab6DFsuvnr2Rk5hWX+fQ2DP6MTvd3GvdVaGyY971+WemQ+NGUqcALNFdGUzvaY 5eLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=FxRHs2wyPRUrl8Oc/6Zrg9c7CYugb7sORMFdnS6XZdM=; b=wNYyBTLwtyPYhEqZ5i7KWYJYSwMlGzri515NKXZZA/7UT1szZXteKWH6uF3l7WvcRX RDomj3rCdAB2/cM2ofKwP8uQADlba/TTMBdkYW/YUesnMgvnb3l9zO/P6otK4KYYjubf eyO/2CLTebYH63xsoLgCEnESROh0Fxp40RMttE4aquJjSbWlyOvHp6Eh9wTg/FOI8q86 K8WzEq3A8WPLBekwakTinDEMbmxSbL8xaiwtmmLZdOE9b+X47GuKD6waD4Lxx4osG8Vu U+LgXLWlNXoLa/u0CM82U3RwPwNsOhnVudggXUCK+CLc+8omY5O4XQzkQdPgyuXwH/+N EZjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=EEguI1tr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5si5742937oil.96.2020.01.13.03.11.48; Mon, 13 Jan 2020 03:12:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=EEguI1tr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728676AbgAMLKo (ORCPT + 99 others); Mon, 13 Jan 2020 06:10:44 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:38188 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbgAMLKo (ORCPT ); Mon, 13 Jan 2020 06:10:44 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00DB8xSP180588; Mon, 13 Jan 2020 11:09:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=FxRHs2wyPRUrl8Oc/6Zrg9c7CYugb7sORMFdnS6XZdM=; b=EEguI1trKNhRE50HyNF9qala8xjNSPCbMzu/36c+B8D6kmzflZsKy+r5LHB1VnLIN/wN TAZ2AXF93hdEx+a+GKGAcmjDC8NVv1JVCHQUxhQZ0gLJaWj419yS6hLhHHXtG1xirODp bt3ghn2lCwBOXLCY8102zahmNNZiHavXdqDcPlsqQhJqhbUKHhlBP+rW0QDnqXns0pJQ wpsHYshG0FM41nBdvxc6F1m3rhGOXvF4VdU307nyKGPa70cMtJhv4fMxRqF3quN+stXv LbqnelXTqEqRo1K3aEYgVrBtiWrkDnyGmj4jUeQ+4urtY/2i+mTs1l5Jycq2alyxuQF2 JQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2xf73y68cu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jan 2020 11:09:18 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00DB9B9S033603; Mon, 13 Jan 2020 11:09:18 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2xfqu4c9g5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jan 2020 11:09:17 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00DB8QKZ006970; Mon, 13 Jan 2020 11:08:27 GMT Received: from kili.mountain (/129.205.23.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 13 Jan 2020 03:08:25 -0800 Date: Mon, 13 Jan 2020 14:08:14 +0300 From: Dan Carpenter To: Bartlomiej Zolnierkiewicz Cc: Andrew Morton , Arnd Bergmann , "Eric W. Biederman" , Andrea Righi , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , Daniel Thompson , Peter Rosin , Jani Nikula , Gerd Hoffmann , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2] fbdev: potential information leak in do_fb_ioctl() Message-ID: <20200113100132.ixpaymordi24n3av@kili.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9498 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001130095 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9498 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001130095 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "fix" struct has a 2 byte hole after ->ywrapstep and the "fix = info->fix;" assignment doesn't necessarily clear it. It depends on the compiler. The solution is just to replace the assignment with an memcpy(). Fixes: 1f5e31d7e55a ("fbmem: don't call copy_from/to_user() with mutex held") Signed-off-by: Dan Carpenter --- v2: Use memcpy() drivers/video/fbdev/core/fbmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index d04554959ea7..bb8d8dbc0461 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1115,7 +1115,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, break; case FBIOGET_FSCREENINFO: lock_fb_info(info); - fix = info->fix; + memcpy(&fix, &info->fix, sizeof(fix)); if (info->flags & FBINFO_HIDE_SMEM_START) fix.smem_start = 0; unlock_fb_info(info); -- 2.11.0