Page MenuHomeFreeBSD

D48348.id148879.diff
No OneTemporary

D48348.id148879.diff

diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1519,6 +1519,7 @@
pcicfgregs *cfg = &dinfo->cfg;
uint32_t status;
uint8_t ptr;
+ int cnt;
/*
* Check the CAP_LIST bit of the PCI status register first.
@@ -1545,9 +1546,11 @@
ptr = pci_read_config(child, ptr, 1);
/*
- * Traverse the capabilities list.
+ * Traverse the capabilities list. Limit by total theoretical
+ * maximum number of caps: capability needs at least id and
+ * next registers, and any type X header cannot contain caps.
*/
- while (ptr != 0) {
+ for (cnt = 0; ptr != 0 && cnt < (PCIE_REGMAX - 0x40) / 2; cnt++) {
if (pci_read_config(child, ptr + PCICAP_ID, 1) == capability) {
if (capreg != NULL)
*capreg = ptr;

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 11, 5:23 PM (9 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31300231
Default Alt Text
D48348.id148879.diff (774 B)

Event Timeline