mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [tip: efi/urgent] efi/fdt: fix panic when no valid fdt found
@ 2021-05-23  9:47 tip-bot2 for Changbin Du
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Changbin Du @ 2021-05-23  9:47 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Changbin Du, Ard Biesheuvel, x86, linux-kernel

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     668a84c1bfb2b3fd5a10847825a854d63fac7baa
Gitweb:        https://git.kernel.org/tip/668a84c1bfb2b3fd5a10847825a854d63fac7baa
Author:        Changbin Du <changbin.du@gmail.com>
AuthorDate:    Wed, 24 Mar 2021 22:54:35 +08:00
Committer:     Ard Biesheuvel <ardb@kernel.org>
CommitterDate: Sat, 22 May 2021 14:03:42 +02:00

efi/fdt: fix panic when no valid fdt found

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 <changbin.du@gmail.com>
Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 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 bb042ab..e901f85 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-23  9:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23  9:47 [tip: efi/urgent] efi/fdt: fix panic when no valid fdt found tip-bot2 for Changbin Du

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®