[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xen/arm: bootfdt: Check return code of device_tree_for_each_node()



commit 02d0a615b32d03702f79807fa5e88f0cf78dde84
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Thu Dec 7 11:14:32 2023 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Thu Dec 7 12:57:21 2023 +0000

    xen/arm: bootfdt: Check return code of device_tree_for_each_node()
    
    As a result of not checking the return code of device_tree_for_each_node()
    in boot_fdt_info(), any error occured during early FDT parsing does not
    stop Xen from booting. This can result in an unwanted behavior in later
    boot stages. Fix it by checking the return code and panicing on an error.
    
    Fixes: 9cf4a9a46717 ("device tree: add device_tree_for_each_node()")
    Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
    Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/arch/arm/bootfdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index b1f03eb2fc..f496a8cf94 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -541,7 +541,9 @@ size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
 
     add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), false);
 
-    device_tree_for_each_node((void *)fdt, 0, early_scan_node, NULL);
+    ret = device_tree_for_each_node((void *)fdt, 0, early_scan_node, NULL);
+    if ( ret )
+        panic("Early FDT parsing failed (%d)\n", ret);
 
     /*
      * On Arm64 setup_directmap_mappings() expects to be called with the lowest
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.