Skip to content

Commit

Permalink
PCI: Check for child busses which use more bus numbers than allocated
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andreas Noever authored and Bjorn Helgaas committed Feb 11, 2014
1 parent f5fb407 commit c95b0bd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c95b0bd

Please sign in to comment.