Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3704299pxk; Tue, 29 Sep 2020 04:16:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQBTasI6xfey9H47G07I7u5OG+0sP/MLE+Ii6FAxmKmpm55hczDusz3Ceh2kyKLNvneBCy X-Received: by 2002:a17:906:aecb:: with SMTP id me11mr3430396ejb.217.1601378200833; Tue, 29 Sep 2020 04:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601378200; cv=none; d=google.com; s=arc-20160816; b=zYtf5xj8T1ku4hr1/yk9Fn9J64CB+9JZRG2ZkuMbQbqkckhZZ+7OHZMbKOBppJQUlX M91pGJfDtEkeFaZqyRQVW8kD8Wo4BSzA0K+/8lBWP5Zvie6imApHytg+ubqpDJx9iJUz A6WvLKjdSTwNP4fyPTTsqnpz6p1eRNStGpcwSfFLIsuPDtw/gNZoUtlP/oqwpRI3fo7m 7bwLs5Lo4z28GJwY4EC9SsgZZToSGkh5MndQZZdtc++6Xema/yS04gjzWVv7+reuTf6k twYFP502zCAx0OUE9L/T8IGbIlT1XfuJB/Ca0tkK0Mr88yfUK4JR+PjAplIVtLp+bRmf r/rA== 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=OORtAHpaz4J2hliI9pk46sMnCNotyrLBH3Nqn/vf8Ag=; b=mORmOXaH85zBUha4C1wWTJhO4kBPixIkbGoGMZeRO4qFkJAmEVPpUklOLf77FKYgDV O+/jLBuJDhWNjUiSuuIeFzQA+rG8/WXCpt1tF9Azn605EA4t7aJI0nW5R9/1fW+pZ5iV WjbPNeWRQ9wjWodkFh1V4QTKKDk+9HXsSj1bTaNHUsKCyv8mUoLvNTvKG+aBQYUZpjKS NLBLR4B1wbOCswW4T1k3OlGVVyHUmkJO0yUiLMmejVaK7idIC072sP9YoCU40np3Q9xc wrLfK/20zcave+uTcc3mOioijjQwdckEGLNCsUAasZmSMSa/mOZ/G92uTegAUnwml0Iw AyeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="NC9//kh1"; 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=fail (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 bu11si2697615ejb.657.2020.09.29.04.16.17; Tue, 29 Sep 2020 04:16:40 -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=@kernel.org header.s=default header.b="NC9//kh1"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729320AbgI2LM0 (ORCPT + 99 others); Tue, 29 Sep 2020 07:12:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:53616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729292AbgI2LMB (ORCPT ); Tue, 29 Sep 2020 07:12:01 -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 6822C21941; Tue, 29 Sep 2020 11:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377921; bh=YBtr1W8K5aODUAYWKFY6BuNG3LLxlaIYNmpyj7AhO+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NC9//kh1aEI285iZkJPOLXDDlelhjIT0qBEqnPCJ2ryQiDgygtUCbg+R80vlbkU3+ WMSLkTxspcvMuKOthmXgzhEqtJ2d240BpNcOpJjitrRy1s8EPM79QVUcaM6Q5oJ7CS FrYqeAWp5nvWAb6BFR68aACQB+Ffnu/SHwAuva3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shreyas Joshi , Sergey Senozhatsky , Petr Mladek , Sasha Levin Subject: [PATCH 4.9 090/121] printk: handle blank console arguments passed in. Date: Tue, 29 Sep 2020 13:00:34 +0200 Message-Id: <20200929105934.639060548@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105930.172747117@linuxfoundation.org> References: <20200929105930.172747117@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: Shreyas Joshi [ Upstream commit 48021f98130880dd74286459a1ef48b5e9bc374f ] If uboot passes a blank string to console_setup then it results in a trashed memory. Ultimately, the kernel crashes during freeing up the memory. This fix checks if there is a blank parameter being passed to console_setup from uboot. In case it detects that the console parameter is blank then it doesn't setup the serial device and it gracefully exits. Link: https://lore.kernel.org/r/20200522065306.83-1-shreyas.joshi@biamp.com Signed-off-by: Shreyas Joshi Acked-by: Sergey Senozhatsky [pmladek@suse.com: Better format the commit message and code, remove unnecessary brackets.] Signed-off-by: Petr Mladek Signed-off-by: Sasha Levin --- kernel/printk/printk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index c1873d325ebda..7acae2f2478d9 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2035,6 +2035,9 @@ static int __init console_setup(char *str) char *s, *options, *brl_options = NULL; int idx; + if (str[0] == 0) + return 1; + if (_braille_console_setup(&str, &brl_options)) return 1; -- 2.25.1