PCI: Check for child busses which use more bus numbers than allocated
authorAndreas Noever <andreas.noever@gmail.com>
Thu, 23 Jan 2014 20:59:27 +0000 (21:59 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 11 Feb 2014 22:16:09 +0000 (15:16 -0700)
pci_scan_child_bus can (potentially) return a bus number higher than the
subordinate value of the child bus. Possible reasons are that bus numbers
are reserved for SR-IOV or for CardBus (SR-IOV is done without checks and
the CardBus checks are sketchy at best).

We clamp the returned value to the actual subordinate value and print a
warning if too many bus numbers are reserved.

[bhelgaas: whitespace]
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/probe.c

index e5df036694706e59c7880badab37c95cd9a31ccf..1436288924c316618288830d9e9029f43e79904a 100644 (file)
@@ -805,10 +805,12 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
                }
 
                cmax = pci_scan_child_bus(child);
-               if (cmax > max)
-                       max = cmax;
-               if (child->busn_res.end > max)
-                       max = child->busn_res.end;
+               if (cmax > subordinate)
+                       dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n",
+                                subordinate, cmax);
+               /* subordinate should equal child->busn_res.end */
+               if (subordinate > max)
+                       max = subordinate;
        } else {
                /*
                 * We need to assign a number to this bus which we always
This page took 0.025785 seconds and 5 git commands to generate.