Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3700416pxk; Tue, 29 Sep 2020 04:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfzUa4aTTD+wSH0fVIA5GSMTFHnygsV1gWqUDOqDIGx1hU9OqgHnnnHwCAIbTF+5d2iH/y X-Received: by 2002:a50:a694:: with SMTP id e20mr2628742edc.114.1601377855233; Tue, 29 Sep 2020 04:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601377855; cv=none; d=google.com; s=arc-20160816; b=dBFcLNwHiYuIVialXB7+DIPfwfpurX76z8M40mZ1F4pOv8TZ9YHZXKre6VWIswTpjp Br4byyMSKNaAAVd7j4Rh2nVeZoxgVjQKNaSr7O7WFMjP1oy2o9vWNmdOEmS3Zh1VRY+o R8egRzXhVt0ilUhBKE7aHWDKGbhlxhrsqZtgrVPjvgM65xXsxkGJfUMGvUsSnbORlusM SlJv7Q3PVJuWF/v0oGKFCxgaHIrG9EiCVa/X1+FLrVhF58igA7i7DV3iVUPixVPV23Tj vyw2vwLLTfjfCaDLnZeKtCsTdUo1hcnBlaL8kt7iJyFX08SunaJVTAwfiIRyzWMIqWC3 53/Q== 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=W0gKpYA9vu/xlsO7e8tUHwqftUoKXLE4twcVyIGw2Q4=; b=uFEVzm5pOxCYQCffO0Pc1C0WygTr5EgMRjARQ7oPIrkUlv46Nnk9i0Q0IXGzsVbPhT v4EWpJRDfEvyz01TRfR9cWHWsAKBruMT2hoc803bUz/iEBXN+HvpZdfiuGbwPYptgqRI c9fgECUCkx4Yoqmb9A7ZNSQvmepdg16nM1ZRE4TVjFkvd98I+YJPONDLpBkg0PqWe64j /z0BgfC3dntTz7+uyeU2Xgpy/F6taTStzONaiyAOOkIaCI43Vz8eRCPX2zo8Faap1WGz VqckxzTAOp77Y+OfN0hLqIU5HJq4OED/pf1XMX8dhuS1LTvWbf7iH9CZ+zY+AbdpUXlv 8iDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="kBW/EwfW"; 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 k6si2628794eds.235.2020.09.29.04.10.32; Tue, 29 Sep 2020 04:10:55 -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="kBW/EwfW"; 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 S1728988AbgI2LI1 (ORCPT + 99 others); Tue, 29 Sep 2020 07:08:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:44064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728828AbgI2LGh (ORCPT ); Tue, 29 Sep 2020 07:06:37 -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 1470222574; Tue, 29 Sep 2020 11:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377590; bh=/ZAwuKiXNjc056PuV0zsg3VrZ2lpMBgP7TwugljyCZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kBW/EwfWKEDCzJ2bjFvXaJqoyAufzxC5BMXwGyJLpSlIjSDF4xqgBcxW1IYxoWtZZ xHlvF+zFVxK8WbVKowA2vdfQDjPH08cqf5rnYmVSnT0lHfuBKsMRrDNqXK7hg4tqcS F41Z+GgwwxY++BzNi+7MN8WlcK16/bZxrJCyXYuA= 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.4 64/85] printk: handle blank console arguments passed in. Date: Tue, 29 Sep 2020 13:00:31 +0200 Message-Id: <20200929105931.413526638@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105928.198942536@linuxfoundation.org> References: <20200929105928.198942536@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 e53a976ca28ea..b55dfb3e801f9 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2032,6 +2032,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