Skip to contentSkip to conversation

pciback: fix circular loop in pcistub_match_one

PATCH In review Jon Mason 2 participants 3 messages Aug 1, 2006 – Aug 2, 2006

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

PATCH 1/1 pciback: fix circular loop in pcistub_match_one

The for loop in pcistub_match_one will loop forever if the dev->bus->self links to itself at the uppermost bridge. Adding a check to prevent linking back in on itself prevents this.

Thanks,
Jon

linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c +3 -0
diff -r d2bf1a7cc131 linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c
@@ -232,6 +232,9 @@ static int __devinit pcistub_match_one(s
 		    && dev->bus->number == pdev_id->bus
 		    && dev->devfn == pdev_id->devfn)
 			return 1;
+
+		if (dev == dev->bus->self)
+			break;
 	}
 
 	return 0;
#1 lore raw
Quoted 3 lines · Jon Mason

The for loop in pcistub_match_one will loop forever if the dev->bus->self links to itself at the uppermost bridge. Adding a check to prevent linking back in on itself prevents this.

Also, please apply & push to our xenlinux tree (or I'll do it if you prefer)

Cheers,
Muli

author
#2 lore raw
Quoted 6 lines · Muli Ben-Yehuda
Quoted 3 lines · Jon Mason

The for loop in pcistub_match_one will loop forever if the dev->bus->self links to itself at the uppermost bridge. Adding a check to prevent linking back in on itself prevents this.

Also, please apply & push to our xenlinux tree (or I'll do it if you prefer)

Will do.

Thanks,
Jon

Quoted 3 lines

Cheers,
Muli