Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151792612
D48348.id148879.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
774 B
Referenced Files
None
Subscribers
None
D48348.id148879.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D48348: pci_find_cap_method(): limit number of iterations for finding a capability
Attached
Detach File
Event Timeline
Log In to Comment