summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2017-07-27 11:05:16 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2017-07-28 17:52:46 +0800
commitfff2623cc2a5e3d85db201a4cf1ca8c595e20075 (patch)
tree4c601bd84c0e759f785b422e043eec761f16bdd2 /MdeModulePkg
parent4f0465058b6ff9c53591ec81951f494a70bde7c1 (diff)
downloadedk2-fff2623cc2a5e3d85db201a4cf1ca8c595e20075.tar.gz
edk2-fff2623cc2a5e3d85db201a4cf1ca8c595e20075.tar.bz2
edk2-fff2623cc2a5e3d85db201a4cf1ca8c595e20075.zip
MdeModulePkg/PciBus: Avoid hang when BUS pad resource is not in top
PciScanBus() assumes the GetResourcePadding() puts BUS descriptor in the very beginning, if it's not, the Descriptors will be updated to point to middle of the pool buffer, which can cause FreePool(Descriptors) hang in DEBUG image. No functionality impact to RELEASE image. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
index e1d62e8c21..8b076e8791 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
@@ -1,7 +1,7 @@
/** @file
Internal library implementation for PCI Bus module.
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -986,6 +986,7 @@ PciScanBus (
UINT64 PciAddress;
EFI_HPC_PADDING_ATTRIBUTES Attributes;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *NextDescriptors;
UINT16 BusRange;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
BOOLEAN BusPadding;
@@ -1143,8 +1144,9 @@ PciScanBus (
}
BusRange = 0;
+ NextDescriptors = Descriptors;
Status = PciGetBusRange (
- &Descriptors,
+ &NextDescriptors,
NULL,
NULL,
&BusRange