Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4848274pxj; Wed, 9 Jun 2021 03:27:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjwg64737MIuTIlXQHt/CPCtjAKArxCVhLFr9t4TjIKDjWwzXwGH7r+dBf1CnsIQ3neRX5 X-Received: by 2002:a17:906:7e4d:: with SMTP id z13mr27529263ejr.50.1623234431834; Wed, 09 Jun 2021 03:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623234431; cv=none; d=google.com; s=arc-20160816; b=R41Or42tA65cu7mRmIr/IskvsZNA/m8xZj+Bu5g0GLaaHdjRHUsrg6GYM5hID4kpCC 9Ioi9TEQ2OtPFm5ibXjeUWnZ7t0ca9yyhKeRfnZk1wI0NiIeDrGtC8XpViM8CsNxbhyu n1m57w77f8mjcBQPtCsPmy2U8AIvqfbeokcYGqhuJ9IwjbWmF4vYhlZidKWBbt8xoHUZ RzqILmJVC2ZwGGrZbP1TL4ZNkTwoNz36Y8K7V6dNCuyBIPhPTknzcZXbN70nf43O0gwy m0Kmu75GRZr6SNcgoLsL9LJAACYZsSusDR8eOn9ie8CdJwpONxyyp4n2B6HqZjEXOOk2 WxAA== 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=wL49KtOVrNZpiFHlpOZkDQrk8fVMnL8Ap4bZANETqdg=; b=o2cWqwwzhgSOQAWznzhzYFsGI9dD7fWtiPpT6NPlxmgqPev50/ZbqeithQIH5ScGbF ZMnBbhetYLvl9z6lDmAGd2JB0SIRfqhbFZHvffFVvxa8ISVppmXu59W8as3wTUNRDova 6/f1RDrBX27u9RswTrBNpMWA2NetF/ZVc+qmMggNwYVuFw4YorEy6hJm4GZPrqt8MUs7 Wej4ryCHdY0w7GGc77jBi8KMLV+kAaCVB50dWLMzmJ7ONg2c3SUBFhnq68VZ7ogTGFRv C1SVliMtDrMwfggXGXdANwxCFt/gPETmM4OYXoXJYDQz1XzC/J/SWC82oZryPZR+N6S3 b/jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JmGEbnzC; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c22si2163364ejj.526.2021.06.09.03.26.48; Wed, 09 Jun 2021 03:27:11 -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=@linuxfoundation.org header.s=korg header.b=JmGEbnzC; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236215AbhFHS7T (ORCPT + 99 others); Tue, 8 Jun 2021 14:59:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:49356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236060AbhFHSwR (ORCPT ); Tue, 8 Jun 2021 14:52:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C88BC61492; Tue, 8 Jun 2021 18:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177606; bh=3HLOSHYbngO5BTWzrLQDEolTQ9SamV+ldW+DLUFDxnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmGEbnzCIlfPAu00G3n6CtmAr55lwyYmu2yitORsW49O18j+SaHjcLMowXoImk6HU +5b0Y3s6Rj+/MKd/p7zAyN18Wyc+ot8fN+8nWhydkXRPgBY1xnGjcYy1gSy45zobHu lV8OhLF2DOC8JFGZQHYX1bApxWMjW2jJmQsGmYy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Changbin Du , Ard Biesheuvel , Sasha Levin Subject: [PATCH 5.10 006/137] efi/fdt: fix panic when no valid fdt found Date: Tue, 8 Jun 2021 20:25:46 +0200 Message-Id: <20210608175942.598702332@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175942.377073879@linuxfoundation.org> References: <20210608175942.377073879@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: Changbin Du [ Upstream commit 668a84c1bfb2b3fd5a10847825a854d63fac7baa ] setup_arch() would invoke efi_init()->efi_get_fdt_params(). If no valid fdt found then initial_boot_params will be null. So we should stop further fdt processing here. I encountered this issue on risc-v. Signed-off-by: Changbin Du Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services") Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- drivers/firmware/efi/fdtparams.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/firmware/efi/fdtparams.c b/drivers/firmware/efi/fdtparams.c index bb042ab7c2be..e901f8564ca0 100644 --- a/drivers/firmware/efi/fdtparams.c +++ b/drivers/firmware/efi/fdtparams.c @@ -98,6 +98,9 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm) BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(name)); BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(dt_params[0].params)); + if (!fdt) + return 0; + for (i = 0; i < ARRAY_SIZE(dt_params); i++) { node = fdt_path_offset(fdt, dt_params[i].path); if (node < 0) -- 2.30.2