Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp140018ybr; Fri, 22 May 2020 03:05:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnU3azg3K3pDntBh2I1peena/YJ6rEXUYbQyXg5OJQUI5h57NgI2k9IP9mhtUp83zJ9b67 X-Received: by 2002:a17:906:f75b:: with SMTP id jp27mr7730211ejb.141.1590141904863; Fri, 22 May 2020 03:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590141904; cv=none; d=google.com; s=arc-20160816; b=lhLNvoco9eLfB7wCq6Lwb/O13ovR9af+NZzSfrU0Vy3ZGSo9ibN3oUeE46dJaltvem 71sdwAXdiJyaZuXdycosZ0MyVkstEbztAseuXRmA+rf0DHpuhXt3OZK+k6yXSAhJW7wQ veuqBCAmV/lMyU/FrlUz5NolcRAH5XpnEmZyLuGMj3Kk1mP8iwjzFkYuORjitodKwMDt b2bb0Kjc6ZkWVOFycpiNh4//8BRv/ilx6ElrvYff6ZGE5YXJtDZJOLmw0uZmgIlZIRPk U8YuHOPOia0n2Xk1GlWFUVxBozfUj1gKSvjHoFT/yNpP5QJ9BXEEpQRdgkOTgnU17hZv nOaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=YRQG3jSq1b1ZTHVLnH29VgAK/sWyK3x6YkYE8vTv6wo=; b=djP5pfCDdHjljRAplQfjeV3+hpVe6Sc4NFnvOhm0H/vpE7DI//gDitS2ZzyeYksHHG akbmkNV9d17yaUW7aiCW4B32ibPB/NmNf7svMDrscacKGzD7lf9WaTxith5CN9DxGHCA sGBhdSJua5/FAR3zpIt2UjOV+uWufaH/slrHYF1FxoTvZ2wGwk0Ic3+t5XRIExGgK9J9 fKwi7QrJ6lKQXcR5xD2X6Qk57GuFvWpD03KHuoOYm0pkOzIYtEQ2j5vwcvceidcrKsOb FItrTwdMZ/96HnSoOIYmvO+C1MzbPJcdNSOdZuuqdp/U2moClzzxCqYYcOKi9yB0UjJ+ IppQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb15si4784862ejb.451.2020.05.22.03.04.39; Fri, 22 May 2020 03:05:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728315AbgEVKAt (ORCPT + 99 others); Fri, 22 May 2020 06:00:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:60744 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726578AbgEVKAt (ORCPT ); Fri, 22 May 2020 06:00:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 33477AC49; Fri, 22 May 2020 10:00:50 +0000 (UTC) Date: Fri, 22 May 2020 12:00:46 +0200 From: Petr Mladek To: Shreyas Joshi Cc: sergey.senozhatsky@gmail.com, rostedt@goodmis.org, shreyasjoshi15@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] printk: handle blank console arguments passed in. Message-ID: <20200522100046.GH3464@linux-b0ei> References: <20200522065306.83-1-shreyas.joshi@biamp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522065306.83-1-shreyas.joshi@biamp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2020-05-22 16:53:06, Shreyas Joshi wrote: > 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. > > Signed-off-by: Shreyas Joshi > --- > V1: > Fixed console_loglevel to default as per the review comments > > 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) { > + return 1; > + } > if (_braille_console_setup(&str, &brl_options)) > return 1; I have fixed formatting and pushed it into printk/linux.git, branch for-5.8. Best Regards, Petr