* [PATCH] arm/efi: Fix null pointer dereference
@ 2021-10-11 7:56 Luca Fancellu
2021-10-11 9:37 ` Bertrand Marquis
0 siblings, 1 reply; 3+ messages in thread
From: Luca Fancellu @ 2021-10-11 7:56 UTC (permalink / raw)
To: xen-devel
Cc: bertrand.marquis, wei.chen, Stefano Stabellini, Julien Grall,
Volodymyr Babchuk
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@xen.org>
Fixes: 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
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");
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arm/efi: Fix null pointer dereference
2021-10-11 7:56 [PATCH] arm/efi: Fix null pointer dereference Luca Fancellu
@ 2021-10-11 9:37 ` Bertrand Marquis
2021-10-11 17:33 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: Bertrand Marquis @ 2021-10-11 9:37 UTC (permalink / raw)
To: Luca Fancellu
Cc: xen-devel, Wei Chen, Stefano Stabellini, Julien Grall, Volodymyr Babchuk
Hi Luca,
> On 11 Oct 2021, at 08:56, Luca Fancellu <Luca.Fancellu@arm.com> wrote:
>
> 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@xen.org>
> Fixes: 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Cheers
Bertrand
> ---
> 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");
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm/efi: Fix null pointer dereference
2021-10-11 9:37 ` Bertrand Marquis
@ 2021-10-11 17:33 ` Stefano Stabellini
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2021-10-11 17:33 UTC (permalink / raw)
To: Bertrand Marquis
Cc: Luca Fancellu, xen-devel, Wei Chen, Stefano Stabellini,
Julien Grall, Volodymyr Babchuk
On Mon, 11 Oct 2021, Bertrand Marquis wrote:
> Hi Luca,
>
> > On 11 Oct 2021, at 08:56, Luca Fancellu <Luca.Fancellu@arm.com> wrote:
> >
> > 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@xen.org>
> > Fixes: 60649d443d ("arm/efi: Introduce xen,uefi-cfg-load DT property")
> > Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> > ---
> > 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");
> > --
> > 2.17.1
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-11 17:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 7:56 [PATCH] arm/efi: Fix null pointer dereference Luca Fancellu
2021-10-11 9:37 ` Bertrand Marquis
2021-10-11 17:33 ` Stefano Stabellini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.