diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2015-09-15 08:47:05 +0000 |
---|---|---|
committer | hwu1225 <hwu1225@Edk2> | 2015-09-15 08:47:05 +0000 |
commit | a7757cf69f830bcfb7c6eed4786b303f23f53140 (patch) | |
tree | f2ffab1f48b7ec9577d93fb580bb5532f0d3b914 /MdeModulePkg/Bus | |
parent | a6c273bb633cca00c0fa0f79fbf95704a8fec5e9 (diff) | |
download | edk2-platforms-a7757cf69f830bcfb7c6eed4786b303f23f53140.tar.xz |
MdeModulePkg: Enhance PCI capability looking up logic to avoid hang
Certain PCI device may have capability pointing to itself.
Update LocateCapabilityRegBlock() to break when detecting such loop.
(Sync patch r18473 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18475 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r-- | MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c index 8a8b4b8fac..0bc1fbfeff 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c @@ -173,6 +173,14 @@ LocateCapabilityRegBlock ( return EFI_SUCCESS;
}
+ //
+ // Certain PCI device may incorrectly have capability pointing to itself,
+ // break to avoid dead loop.
+ //
+ if (CapabilityPtr == (UINT8) (CapabilityEntry >> 8)) {
+ break;
+ }
+
CapabilityPtr = (UINT8) (CapabilityEntry >> 8);
}
|