diff options
author | Andreas Noever <andreas.noever@gmail.com> | 2014-01-23 15:59:27 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-02-11 17:16:09 -0500 |
commit | c95b0bd6ca3dbb1abf8394c38d26df65d890cb9a (patch) | |
tree | 0244c2a3b03cf64e3ddb03b09089e46dcd7cf6da /drivers/pci | |
parent | f5fb40700fc9a52944fbe07148c858a5025908b1 (diff) |
PCI: Check for child busses which use more bus numbers than allocated
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/probe.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index e5df03669470..1436288924c3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -805,10 +805,12 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
805 | } | 805 | } |
806 | 806 | ||
807 | cmax = pci_scan_child_bus(child); | 807 | cmax = pci_scan_child_bus(child); |
808 | if (cmax > max) | 808 | if (cmax > subordinate) |
809 | max = cmax; | 809 | dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n", |
810 | if (child->busn_res.end > max) | 810 | subordinate, cmax); |
811 | max = child->busn_res.end; | 811 | /* subordinate should equal child->busn_res.end */ |
812 | if (subordinate > max) | ||
813 | max = subordinate; | ||
812 | } else { | 814 | } else { |
813 | /* | 815 | /* |
814 | * We need to assign a number to this bus which we always | 816 | * We need to assign a number to this bus which we always |