Add a check for ResourcePaddingDescriptors being a valid pointer in
DumpPpbPaddingResource() to prevent looping on memory not owned by
PciBusDxe.  The ResourcePaddingDescriptors is initialized to NULL
when the PCI_IO_DEVICE structure is allocated and remains NULL if
no PCI hot plug controllers are present.  This issue is only
observed when DEBUG_CODE() macros are enabled and was introduced
by the following patch:

  [edk2] [Patch] MdeModulePkg: Fix a PciBusDxe hot plug bug
  SVN revsion 18658

Cc: Ruiyu Ni <[email protected]>
Cc: Leif Lindholm <[email protected]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <[email protected]>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 030ef42..a6ade26 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -338,10 +338,14 @@ DumpPpbPaddingResource (
   )
 {
   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;
   PCI_BAR_TYPE                      Type;
 
+  if (PciIoDevice->ResourcePaddingDescriptors == NULL) {
+    return;
+  }
+
   if (ResourceType == PciBarTypeIo16 || ResourceType == PciBarTypeIo32) {
     ResourceType = PciBarTypeIo;
   }
 
   for (Descriptor = PciIoDevice->ResourcePaddingDescriptors; Descriptor->Desc 
!= ACPI_END_TAG_DESCRIPTOR; Descriptor++) {
-- 
1.9.5.msysgit.1

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

Reply via email to