arm/efi: Fix null pointer dereference
PATCH 1/1 arm/efi: Fix null pointer dereference
Fix for commit 60649d443dc395243e74d2b3e05594ac0c43cfe3 that introduces a null pointer dereference when the fdt_node_offset_by_compatible is called with "fdt" argument null.
Reported-by Julien Grall <[email protected]>
Fixes 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")
Signed-off-by Luca Fancellu <[email protected]>
--- xen/arch/arm/efi/efi-boot.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/arm/efi/efi-boot.h +2 -1
@@ -593,7 +593,8 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) dtbfile.ptr = fdt; dtbfile.need_to_free = false;/* Config table memory can't be freed. */ -if (fdt_node_offset_by_compatible (fdt,0 ,"multiboot,module" ) >0 ) +if ( fdt && + (fdt_node_offset_by_compatible (fdt,0 ,"multiboot,module" ) >0 ) ) {/* Locate chosen node */ int node =fdt_subnode_offset (fdt,0 ,"chosen" );
Signature · 1 line
2.17.1
Hi Luca,
Quoted 10 lines · Luca Fancellu
Fix for commit
60649d443dc395243e74d2b3e05594ac0c43cfe3that introduces a null pointer dereference when thefdt_node_offset_by_compatibleis called with "fdt" argument null.Reported-by Julien Grall <[email protected]>Fixes 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")Signed-off-by Luca Fancellu <[email protected]>
Reviewed-by Bertrand Marquis <[email protected]>
Cheers
Bertrand
Quoted 21 lines
---
xen/arch/arm/efi/efi-boot.h| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)xen/arch/arm/efi/efi-boot.h +2
-1@@ -593,7 +593,8 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) dtbfile.ptr = fdt; dtbfile.need_to_free = false;/* Config table memory can't be freed. */ -if (fdt_node_offset_by_compatible (fdt,0 ,"multiboot,module" ) >0 ) +if ( fdt && + (fdt_node_offset_by_compatible (fdt,0 ,"multiboot,module" ) >0 ) ) {/* Locate chosen node */ int node =fdt_subnode_offset (fdt,0 ,"chosen" );Signature · 1 line
2.17.1
Stefano Stabellini
Reviewed-byQuoted 9 lines · Bertrand Marquis
Hi Luca,
Quoted 7 lines · Luca Fancellu
Fix for commit
60649d443dc395243e74d2b3e05594ac0c43cfe3that introduces a null pointer dereference when thefdt_node_offset_by_compatibleis called with "fdt" argument null.
Quoted 4 lines
Quoted 3 lines
Reported-by Julien Grall <[email protected]>Fixes 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")Signed-off-by Luca Fancellu <[email protected]>Reviewed-by Bertrand Marquis <[email protected]>
Reviewed-by Stefano Stabellini <[email protected]>
Quoted 22 lines
Quoted 21 lines
---
xen/arch/arm/efi/efi-boot.h| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)xen/arch/arm/efi/efi-boot.h +2
-1@@ -593,7 +593,8 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) dtbfile.ptr = fdt; dtbfile.need_to_free = false;/* Config table memory can't be freed. */ -if (fdt_node_offset_by_compatible (fdt,0 ,"multiboot,module" ) >0 ) +if ( fdt && + (fdt_node_offset_by_compatible (fdt,0 ,"multiboot,module" ) >0 ) ) {/* Locate chosen node */ int node =fdt_subnode_offset (fdt,0 ,"chosen" );Signature · 1 line
2.17.1