Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp875073pxk; Thu, 17 Sep 2020 20:00:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7Lt05h8WdZ5uOj/FHO3JkwTOzctc2i8EccbYedK86l4fg8qS4HsF9FG7jZ+T448lM4n2N X-Received: by 2002:a17:906:c18e:: with SMTP id g14mr34545659ejz.416.1600398032627; Thu, 17 Sep 2020 20:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398032; cv=none; d=google.com; s=arc-20160816; b=U395q95WS4dQoOip7U+iO+NoiSnUxo4jSbTLZZ9LRfV+/gZSbthOuXstJVbwDCNRCb 9Mz9dEY+YaToRKBAZwYI9yQXm8/47VQOFs7TOzcY3X+1TxSMid5t8x9/+GU8DLH6LiTY hLTUiuqs9tIc1cTi98FO5Q29eJuUM6wKJ3b5lrQmRRIySjUkm5FgRcxNqvNvZ2gkIqUa INaa6Oq5WANrs3pwQSj3P1QWOLYFW5bCoWysKxeAvzcsB7I8LifgfwYAPsmfQCpNFyDA 7Rw3ZmR1+JmRYLi9rbn5nIpOJq3zg4Kg72c6zpmpwijR9IY0qg6pFWDwrA9/EBiciV/c 8e+w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HGdXEVECZ2TxHh9iyRDKK8zKJ5oMdlZNmKecTJeL4xE=; b=VcysK4QnVziKr5J7fuEF0ukj5tGpTqfT89pvwz7B6fFdovQH2Or40qwMY0M4AWtzy6 lwQqKIpgDP6gU34+56n0zO/01lGNk8QDxCdOwFvjE/7MiUd34DfRrgH4hLQA4YDnWmBV k/y9/l3rfDQ6+OpJzqdkWShLTWRZywuscY0EphmlaFEXijjAIRCdicsRAdM2TTKhJy+8 eH7+irE9qtPHM4w8GX/jPAmtzu+soG52RINqnG/1eREv76pCnVOyIl+HV40PLbcWVFAt ACKsQrljgM76sDoH6ZBrKuluG8DSz4961qhe2ijqT0GkMaMWGBMmWrRlKJ3sFzaiSKAk dQ2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="P4b/v8sM"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si1251551ejy.154.2020.09.17.20.00.09; Thu, 17 Sep 2020 20:00:32 -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="P4b/v8sM"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730351AbgIRC4U (ORCPT + 99 others); Thu, 17 Sep 2020 22:56:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:56484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727843AbgIRCHH (ORCPT ); Thu, 17 Sep 2020 22:07:07 -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 853B223998; Fri, 18 Sep 2020 02:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394818; bh=EWJcn+IBaqU5jMI0HlN8uN+YF8Kf7JtXNO7GJDL6Qr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4b/v8sMfek/iSqzKiqJIdLEIWB/Wk3K4sI23tGMlnS+k5mtGKNpIfA1KUc/zHvmp LFhO49alJ6JLZ2G+de0xVl5BNTbrKkaJjKJ+DCbiRr4GGKzm70AH6maRIMXmTwBDuO cg1A1bTmT//O70nZYX7IJ+ZKFyg0Q2Pq5ZlsyPz4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shreyas Joshi , Sergey Senozhatsky , Petr Mladek , Sasha Levin Subject: [PATCH AUTOSEL 5.4 284/330] printk: handle blank console arguments passed in. Date: Thu, 17 Sep 2020 22:00:24 -0400 Message-Id: <20200918020110.2063155-284-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 971197f5d8ee5..5569ef6bc1839 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2193,6 +2193,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