Reviewed-by: Erik Bjorge <[email protected]>

> -----Original Message-----
> From: Leahy, Leroy P
> Sent: Thursday, February 25, 2016 11:17 AM
> To: Ni, Ruiyu <[email protected]>; Bjorge, Erik C
> <[email protected]>; [email protected]
> Cc: Leahy, Leroy P <[email protected]>
> Subject: [PATCH v3] DuetPkg-PciBusNoEnumerationDxe: Fix stack overflow
> 
> When a PCI bridge is not enabled, the secondary bus may still be zero.
> This causes an infinite recursive call to enumerate bus 0 which results
> in a stack overflow.  The easy fix is to skip the recursive bus
> enumeration for devices which are not enabled either for memory or I/O
> accesses.
> 
> TEST=Build and run CorebootPayloadPkg on Quark/Galileo Gen2
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Lee Leahy <[email protected]>
> ---
>  DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c
> b/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c
> index 80b2b6b..7f8393a 100644
> --- a/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c
> +++ b/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c
> @@ -243,7 +243,9 @@ Returns:
>          //
>          //
> 
> -        if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci) ||
> IS_CARDBUS_BRIDGE (&Pci))) {
> +        if (!EFI_ERROR (Status) && (Pci.Hdr.Command &
> (EFI_PCI_COMMAND_IO_SPACE
> +            | EFI_PCI_COMMAND_MEMORY_SPACE))
> +          && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {
> 
>            //
>            // If it is PPB, we need to get the secondary bus to continue
> the enumeration
> --
> 1.9.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to