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

[xen master] arm/efi: Fix null pointer dereference



commit 4817dbf1c808064ee15416dba1db30cb793dfa98
Author:     Luca Fancellu <luca.fancellu@xxxxxxx>
AuthorDate: Mon Oct 11 08:56:38 2021 +0100
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
CommitDate: Mon Oct 11 13:19:35 2021 -0700

    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 <julien@xxxxxxx>
    Fixes: 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")
    Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/efi/efi-boot.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index a3e46453d4..e63dafac26 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -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");
--
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®.