]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DuetPkg-PciBusNoEnumerationDxe: Fix stack overflow
authorLee Leahy <leroy.p.leahy@intel.com>
Fri, 26 Feb 2016 02:07:51 +0000 (10:07 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 26 Feb 2016 02:39:15 +0000 (10:39 +0800)
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 bridges which do not have the secondary bus initialized.

TEST=Build and run CorebootPayloadPkg on Quark/Galileo Gen2

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c

index 80b2b6b24d24f7bc8e0ee27d615c0d863779dd8e..ca300cf675f70d01163f2f0ba07fdd99767ecd55 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
@@ -257,13 +257,14 @@ Returns:
           }\r
               \r
           //\r
-          // Deep enumerate the next level bus\r
+          // If the PCI bridge is initialized then enumerate the next level bus\r
           //\r
-          Status = PciPciDeviceInfoCollector (\r
-                    PciIoDevice,\r
-                    (UINT8) (SecBus)\r
-                    );\r
-\r
+          if (SecBus != 0) {\r
+            Status = PciPciDeviceInfoCollector (\r
+                      PciIoDevice,\r
+                      (UINT8) (SecBus)\r
+                      );\r
+          }\r
         }\r
 \r
         if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {\r