Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2189270ybv; Mon, 24 Feb 2020 00:40:45 -0800 (PST) X-Google-Smtp-Source: APXvYqx8JWp1e5h+mS0V80L4p6ZPtNnPiQmRPshwnd1p+MWGuaMQE09AWLgargOOmgNtN7omBJ5o X-Received: by 2002:a05:6830:1447:: with SMTP id w7mr4675451otp.368.1582533645129; Mon, 24 Feb 2020 00:40:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582533645; cv=none; d=google.com; s=arc-20160816; b=0BzHTAkH9frQEvlayWuUaCXPo5k6ZRwt+S8bCWBEA5UnDOh2lQEs6k32Mz/ZD/4jnA WgmUdCfZ+/XDios1DVJimnbNSCyvw79+WGjW2+QGaifo0ixxiRxncGzPu+JZoT5rldc7 9jrJbBID0Fz8mLHCBTYgjydBMEGU842u4KMqlSuhMdQq4wIVCf2B4GKDeT5Z6Wz/nzzB wdM3kI12si779rommpTBHkQ1jY3wn3+zP5TwSGxFT96ZZPHPg/v5fukQ48prIAf8RyBl wEvRfzzmX/3BqJWCa1MnNyrn2VCHMupkUu8AT1RrWFPuGh1xf/s2UNnY4LQb0m4KeXP+ X6Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UouyjXwkk6GMZHEViTGRX4SPSdTh1lJUMhVBsHS17vU=; b=zw92RrfrPfltvh3nKQtGQfzlBDcG1Q50nlMaQHGInJK+PsgbwTRnSlnGpkHl/IE+an iEoH2ZjXplIZNFktkcS2jR36fex2n/he50hrLIF1eKlFP0B8XTVlYk5RYGcFct+DfZl5 /1ALRKo47U6bJkulpTm1WLOn3uYvyy/yZFXwEPRefweZu9TRHKBU9FxwfQ33Qujh221K fU/ln7YwgQwrh3v0lXG3Yd4cp1pEIiqQCOkuJpSZff7wS8dahdJ84+61vMJ3HxgqJCuq F6ICxUdFvYk+GA8YccyyKInUgjqveZPQPHyP6m5iRgOAsg7ajWvMpwW47qWVNr7g6H7/ NkUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x88gTQHR; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si4869365oif.256.2020.02.24.00.40.32; Mon, 24 Feb 2020 00:40:45 -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=@kernel.org header.s=default header.b=x88gTQHR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727312AbgBXIjW (ORCPT + 99 others); Mon, 24 Feb 2020 03:39:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:51950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727168AbgBXIjW (ORCPT ); Mon, 24 Feb 2020 03:39:22 -0500 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66A5B20661; Mon, 24 Feb 2020 08:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582533561; bh=i6Nzvo7MFgvQK+Kwv//m7fnUr/Yby9wrtOGUf97vUc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x88gTQHRYmutwqv2YL5+EuTyw2DJ3U+u2XEyOrOVBOWrPALGx7ZHfp1u9u5l37YqH GlLJrK6+HtQrfU7zMai7ZarA+By/bMbiEKjyW+VeZwsCjAqnKRMmrK+6sqoR07sGQW 54lG5DnoQ+ER1hP4v+8rzWQTpxWQgRSXQHRAx+4U= From: Eric Biggers To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Al Viro Subject: [PATCH] tty: fix compat TIOCGSERIAL leaking uninitialized memory Date: Mon, 24 Feb 2020 00:38:38 -0800 Message-Id: <20200224083838.306381-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <000000000000387920059f4e0351@google.com> References: <000000000000387920059f4e0351@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers Commit 77654350306a ("take compat TIOC[SG]SERIAL treatment into tty_compat_ioctl()") changed the compat version of TIOCGSERIAL to start copying a whole struct to userspace rather than individual fields, but failed to initialize all padding and fields -- namely the hole after the 'iomem_reg_shift' field, and the 'reserved' field. Fix this by initializing the struct to zero. Reported-by: syzbot+8da9175e28eadcb203ce@syzkaller.appspotmail.com Fixes: 77654350306a ("take compat TIOC[SG]SERIAL treatment into tty_compat_ioctl()") Cc: # v4.20+ Signed-off-by: Eric Biggers --- drivers/tty/tty_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 1fcf7ad83dfa0..d24c250312edf 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2731,6 +2731,7 @@ static int compat_tty_tiocgserial(struct tty_struct *tty, struct serial_struct v; int err; memset(&v, 0, sizeof(struct serial_struct)); + memset(&v32, 0, sizeof(struct serial_struct32)); if (!tty->ops->set_serial) return -ENOTTY; -- 2.25.1