From patchwork Tue Sep 29 10:57:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 290940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 322E1C4741F for ; Tue, 29 Sep 2020 12:09:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE98520773 for ; Tue, 29 Sep 2020 12:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601381374; bh=XooXO7f0+p2i4ItHkoDZBtIGouKukXVbkWk0foHqTds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KvEmJMKHThg/Fco8S/dfvQowli3nS4M1HwkNgESm/zXfN/U68lHCw4oQYA9oXRFGm ejgu+OAT4e3VfrkmZYqPKRht5fPnwm4USsmRCb7rwDO3RjqlaFmSkuPcBAX3MrSkqz Lq5+0g2F1mRnb+0bbYSZmshWN5+1HH7kh2ODeBMo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731926AbgI2MJe (ORCPT ); Tue, 29 Sep 2020 08:09:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:49816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730208AbgI2Lhf (ORCPT ); Tue, 29 Sep 2020 07:37:35 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3514D23977; Tue, 29 Sep 2020 11:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378534; bh=XooXO7f0+p2i4ItHkoDZBtIGouKukXVbkWk0foHqTds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TX0gmt+N0wuYE7Kfr+W85uv0cepykE5fql7rOZ4jobQE+8WTtj0x04NWuw3Y4LCkW huuElpT7BY5s16Xb3pOsIYOVoFSVzQc5cXg/BEsmEL6w8KbNYAMq6o2/yQvsPHNxEi t8CNfeXh1zzD6QHtWLHSoOkBHsuC0i/XuNPI4srs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fuqian Huang , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 4.19 008/245] m68k: q40: Fix info-leak in rtc_ioctl Date: Tue, 29 Sep 2020 12:57:39 +0200 Message-Id: <20200929105947.395169493@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Fuqian Huang [ Upstream commit 7cf78b6b12fd5550545e4b73b35dca18bd46b44c ] When the option is RTC_PLL_GET, pll will be copied to userland via copy_to_user. pll is initialized using mach_get_rtc_pll indirect call and mach_get_rtc_pll is only assigned with function q40_get_rtc_pll in arch/m68k/q40/config.c. In function q40_get_rtc_pll, the field pll_ctrl is not initialized. This will leak uninitialized stack content to userland. Fix this by zeroing the uninitialized field. Signed-off-by: Fuqian Huang Link: https://lore.kernel.org/r/20190927121544.7650-1-huangfq.daxian@gmail.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/m68k/q40/config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c index 96810d91da2bd..4a25ce6a1823d 100644 --- a/arch/m68k/q40/config.c +++ b/arch/m68k/q40/config.c @@ -273,6 +273,7 @@ static int q40_get_rtc_pll(struct rtc_pll_info *pll) { int tmp = Q40_RTC_CTRL; + pll->pll_ctrl = 0; pll->pll_value = tmp & Q40_RTC_PLL_MASK; if (tmp & Q40_RTC_PLL_SIGN) pll->pll_value = -pll->pll_value;