lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240521-loongarch-booting-fixes-v1-1-659c201c0370@flygoat.com>
Date: Tue, 21 May 2024 21:12:12 +0100
From: Jiaxun Yang <jiaxun.yang@...goat.com>
To: Huacai Chen <chenhuacai@...nel.org>, 
 Binbin Zhou <zhoubinbin@...ngson.cn>
Cc: loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org, 
 Jiaxun Yang <jiaxun.yang@...goat.com>, stable@...r.kernel.org
Subject: [PATCH 1/4] LoongArch: Fix built-in DTB detection

fdt_check_header(__dtb_start) will always success because kernel
provided a dummy dtb here, thus fdt passed from firmware will
never be taken.

Fix by trying to utilise __dtb_start only when CONFIG_BUILTIN_DTB
is enabled.

Fixes: 5f346a6e5970 ("LoongArch: Allow device trees be built into the kernel")
Cc: stable@...r.kernel.org
Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
---
 arch/loongarch/kernel/setup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 60e0fe97f61a..ea6d5db6c878 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -275,16 +275,18 @@ static void __init arch_reserve_crashkernel(void)
 static void __init fdt_setup(void)
 {
 #ifdef CONFIG_OF_EARLY_FLATTREE
-	void *fdt_pointer;
+	void *fdt_pointer = NULL;
 
 	/* ACPI-based systems do not require parsing fdt */
 	if (acpi_os_get_root_pointer())
 		return;
 
+#ifdef CONFIG_BUILTIN_DTB
 	/* Prefer to use built-in dtb, checking its legality first. */
 	if (!fdt_check_header(__dtb_start))
 		fdt_pointer = __dtb_start;
-	else
+#endif
+	if (!fdt_pointer)
 		fdt_pointer = efi_fdt_pointer(); /* Fallback to firmware dtb */
 
 	if (!fdt_pointer || fdt_check_header(fdt_pointer))

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ