From: kfraser@localhost.localdomain Date: Wed, 2 Aug 2006 08:15:26 +0000 (+0100) Subject: [PCI] back: Fix potential infinite loop in pcistub_match_one(). X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15754^2~20 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bef5a7699a6b0c665bddadf91691a46e7d39b8d5;p=xen.git [PCI] back: Fix potential infinite 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. Signed-off-by: Jon Mason --- diff --git a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c index aab9238c2d..b33855932d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c @@ -232,6 +232,10 @@ static int __devinit pcistub_match_one(struct pci_dev *dev, && dev->bus->number == pdev_id->bus && dev->devfn == pdev_id->devfn) return 1; + + /* Sometimes topmost bridge links to itself. */ + if (dev == dev->bus->self) + break; } return 0;