[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging-4.10] xen/arm: check for multiboot nodes only under /chosen
commit 0b18340cf6603c3fabd0d11dcaf3b021591987dc Author: Stefano Stabellini <sstabellini@xxxxxxxxxx> AuthorDate: Tue Nov 13 08:45:49 2018 -0800 Commit: Stefano Stabellini <sstabellini@xxxxxxxxxx> CommitDate: Fri Jan 25 17:22:10 2019 -0800 xen/arm: check for multiboot nodes only under /chosen Make sure to only look for multiboot compatible nodes only under /chosen, not under any other paths (depth <= 3). Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx> [julien: Use sizeof(path) instead of len ] Reviewed-by: Julien Grall <julien.grall@xxxxxxx> (cherry picked from commit c32e3689c546305d4eae53e6ccf9c8b4e048c7df) (cherry picked from commit 02fd1ee8ce00ca2a1b89bb17703d667209fc49fb) --- xen/arch/arm/bootfdt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index 8eba42c7b9..797fcefd9e 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -174,6 +174,14 @@ static void __init process_multiboot_node(const void *fdt, int node, paddr_t start, size; const char *cmdline; int len; + /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' => 92 */ + char path[92]; + int ret; + + /* Check that the node is under "/chosen" (first 7 chars of path) */ + ret = fdt_get_path(fdt, node, path, sizeof (path)); + if ( ret != 0 || strncmp(path, "/chosen", 7) ) + return; prop = fdt_get_property(fdt, node, "reg", &len); if ( !prop ) @@ -286,8 +294,8 @@ static int __init early_scan_node(const void *fdt, { if ( device_tree_node_matches(fdt, node, "memory") ) process_memory_node(fdt, node, name, address_cells, size_cells); - else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) || - device_tree_node_compatible(fdt, node, "multiboot,module" )) + else if ( depth <= 3 && (device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) || + device_tree_node_compatible(fdt, node, "multiboot,module" ))) process_multiboot_node(fdt, node, name, address_cells, size_cells); else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") ) process_chosen_node(fdt, node, name, address_cells, size_cells); -- generated by git-patchbot for /home/xen/git/xen.git#staging-4.10 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |