MdeModulePkg: Skip invalid bus number scanning in PciBusDxe driver
authorMa, Maurice <maurice.ma@intel.com>
Mon, 16 May 2016 21:26:06 +0000 (05:26 +0800)
committerFeng Tian <feng.tian@intel.com>
Wed, 18 May 2016 08:03:30 +0000 (16:03 +0800)
When PcdPciDisableBusEnumeration is enabled, the PciBus driver
might get into a dead loop if the secondary bus register on PCI
bridge is not programmed or programmed improperly. Adding this
check to avoid any potential dead loop caused by this.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Lee Leahy <Leroy.p.leahy@intel.com>
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c

index a6ade26e3a09786970dc0a46fc0684d8e3c76a0a..086c481130c8363728ae91f3ac30a7b5260e65cc 100644 (file)
@@ -164,6 +164,14 @@ PciPciDeviceInfoCollector (
             return Status;\r
           }\r
 \r
+          //\r
+          // Ensure secondary bus number is greater than the primary bus number to avoid\r
+          // any potential dead loop when PcdPciDisableBusEnumeration is set to TRUE\r
+          //\r
+          if (SecBus <= StartBusNumber) {\r
+            break;\r
+          }\r
+\r
           //\r
           // Get resource padding for PPB\r
           //\r