Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3244997ybh; Mon, 16 Mar 2020 19:04:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs9/eEPYUPIFeLYRE+nTrTBXn1wEapbcuda9gzwOV+rOXMuIF0rpQlUHOVewO7f3mKJVN7P X-Received: by 2002:aca:f183:: with SMTP id p125mr1915979oih.74.1584410692369; Mon, 16 Mar 2020 19:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584410692; cv=none; d=google.com; s=arc-20160816; b=snlnqVYLtg/+cT5fdk+BtQ90GK6EBRAaDXJQcNntlaz9/Db9WqBIAH19qrV9VdTlW8 Xnb1ofmb07BqEtk9y4BBQe8McfxqOubh8EySytq5sfZc9GJaUhNgly3yEX8W18qeRx03 pa6unyan3UhvI7Qo93ZCOysUrkgFA4rCpCeOqAiYwFqRFMlGGK9gmIKsQuw2/wLA8U3t qVZfg+nRR33j/z60+VvwsqhQF0OVB8ugVTlWswEClGmQJJdtNpx11U7fA0947hHXulf9 vALis5AY77K83zwrAzU4m6WYZN60E40cI1WvTRUn6hSXKwBRTuHeTJ1cUNVFn2hFfRE0 R7lg== 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:subject:cc:to:from:date; bh=qNFybNx0r4mcbtFUscXfsYiLEGETUK6Ip/4U4WP5Z0U=; b=ASf/AVIRU/wOyjbXXoH2zFMW7nsHNkNPhxr/Rh/zm0SRp+y/MEEjOyI4SjOEgO/Q91 FU+VZuwImS4oLmivpPu63RKpqaDsprSfz3EgiWupNcuqflp1VIlBOESPi1Bvb7qB4FCx VjlQZvRQX460aLolk6E4+Hm3LjQ2Ym+vDI//TKeWE2qEgEyDPXkOmFTvav6pxDepRsqw ZIYzyM6waPWn3tFmnDnU6l3CXO2EyJ+In+L5X5IKG6EurwJkWp/sYOPY0hzrVeUvOsfi /9kOugb48wOOSE0WTY/4p6Hmz6REkHK79Vk79quEVjCsZ0DLMNVQaLT/FjzzRJZNBmDX LT4Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si975040ote.134.2020.03.16.19.04.40; Mon, 16 Mar 2020 19:04:52 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbgCQBjD (ORCPT + 99 others); Mon, 16 Mar 2020 21:39:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:45332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgCQBjD (ORCPT ); Mon, 16 Mar 2020 21:39:03 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 7FF412051A; Tue, 17 Mar 2020 01:39:02 +0000 (UTC) Date: Mon, 16 Mar 2020 21:39:00 -0400 From: Steven Rostedt To: Shreyas Joshi Cc: "pmladek@suse.com" , "sergey.senozhatsky@gmail.com" , "shreyasjoshi15@gmail.com" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] printk: handle blank console arguments passed in. Message-ID: <20200316213900.6b1eb594@oasis.local.home> In-Reply-To: References: <20200309052915.858-1-shreyas.joshi@biamp.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Mar 2020 01:34:43 +0000 Shreyas Joshi wrote: Hi Shreyas! > 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. Please line wrap you commit messages to at most 75 characters. > > Signed-off-by: Shreyas Joshi > --- > kernel/printk/printk.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ad4606234545..e9ad730991e0 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2165,7 +2165,10 @@ static int __init console_setup(char *str) > char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for "ttyS" */ > char *s, *options, *brl_options = NULL; > int idx; > - > + if (str[0] == 0) { > + console_loglevel = 0; > + return 1; Hmm, I wonder if this should produce a warning :-/ -- Steve > + } > if (_braille_console_setup(&str, &brl_options)) > return 1; > > -- > 2.20.1