aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-09-13 14:16:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-09-13 19:08:31 -0400
commit1a4b1a41b8a3d5256019854e851beed063b34344 (patch)
treefa62183e093cf032c74cac8149fb69a49b07b7e0 /drivers/pci
parent2f4d3218e95d48de2951dcf2bea619ea49ef93de (diff)
pci: Don't crash when reading mpss from root complex
In pcie_find_smpss(), we have the following statement: if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || dev->bus->self->pcie_type != PCI_EXP_TYPE_ROOT_PORT)) The problem is that at least on my machine, this gets called for the root complex (virtual P2P bridge), and dev->bus->self is NULL since the parent bus for this is not itself anchor to a PCI device. This adds the necessary NULL check. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Jon Mason <mason@myri.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/probe.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b1187ff31d8..f3f94a5c068 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1351,7 +1351,8 @@ static int pcie_find_smpss(struct pci_dev *dev, void *data)
1351 * will occur as normal. 1351 * will occur as normal.
1352 */ 1352 */
1353 if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || 1353 if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) ||
1354 dev->bus->self->pcie_type != PCI_EXP_TYPE_ROOT_PORT)) 1354 (dev->bus->self &&
1355 dev->bus->self->pcie_type != PCI_EXP_TYPE_ROOT_PORT)))
1355 *smpss = 0; 1356 *smpss = 0;
1356 1357
1357 if (*smpss > dev->pcie_mpss) 1358 if (*smpss > dev->pcie_mpss)