From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 126A2C004C9 for ; Tue, 7 May 2019 05:58:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6B11205C9 for ; Tue, 7 May 2019 05:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557208712; bh=wbY17iC+YFYv7hcWzcyg95eJdFrNRIjFZv1JtEP1hZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2FjYh1gE94OhC17iXMMZWpR3RarNQK5HHvLvej4bzMIAZsjpNIZOCu40LmuypinbT Ut9A77gM2Ds3uusWHW+Wh0TrEYaicPsgLoZW1LUlWnsxBC5I8PVdupN2NIs5MNU4zK T0/558YopWAt1JPH4/Gyw0QYp0iKjnjXpOpuzZos= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728851AbfEGF6b (ORCPT ); Tue, 7 May 2019 01:58:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:56882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728262AbfEGFhI (ORCPT ); Tue, 7 May 2019 01:37:08 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 962A52087F; Tue, 7 May 2019 05:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557207427; bh=wbY17iC+YFYv7hcWzcyg95eJdFrNRIjFZv1JtEP1hZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PM0raNILrCXWIPqhaRNXYi23oi8UoE5DAjCZ6BSBtItNIt2PvuYK/3vYeiknRzgO+ 7pDYEVHBxaWRWGd6b5gbq2y5HJl856vnW7zUuAh/0Fk90gT8N4wokiPCgGy3Q/XpE4 cHHqL7o2fD+QiK0D9so4y0L2AhWcX/lGH179TrG0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tony Camuso , Corey Minyard , Sasha Levin Subject: [PATCH AUTOSEL 4.19 37/81] ipmi: ipmi_si_hardcode.c: init si_type array to fix a crash Date: Tue, 7 May 2019 01:35:08 -0400 Message-Id: <20190507053554.30848-37-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190507053554.30848-1-sashal@kernel.org> References: <20190507053554.30848-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Camuso [ Upstream commit a885bcfd152f97b25005298ab2d6b741aed9b49c ] The intended behavior of function ipmi_hardcode_init_one() is to default to kcs interface when no type argument is presented when initializing ipmi with hard coded addresses. However, the array of char pointers allocated on the stack by function ipmi_hardcode_init() was not inited to zeroes, so it contained stack debris. Consequently, passing the cruft stored in this array to function ipmi_hardcode_init_one() caused a crash when it was unable to detect that the char * being passed was nonsense and tried to access the address specified by the bogus pointer. The fix is simply to initialize the si_type array to zeroes, so if there were no type argument given to at the command line, function ipmi_hardcode_init_one() could properly default to the kcs interface. Signed-off-by: Tony Camuso Message-Id: <1554837603-40299-1-git-send-email-tcamuso@redhat.com> Signed-off-by: Corey Minyard Signed-off-by: Sasha Levin --- drivers/char/ipmi/ipmi_si_hardcode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/char/ipmi/ipmi_si_hardcode.c b/drivers/char/ipmi/ipmi_si_hardcode.c index 9ae2405c28bb..0c28e872ad3a 100644 --- a/drivers/char/ipmi/ipmi_si_hardcode.c +++ b/drivers/char/ipmi/ipmi_si_hardcode.c @@ -200,6 +200,8 @@ void __init ipmi_hardcode_init(void) char *str; char *si_type[SI_MAX_PARMS]; + memset(si_type, 0, sizeof(si_type)); + /* Parse out the si_type string into its components. */ str = si_type_str; if (*str != '\0') { -- 2.20.1