PCI: pciehp: Prevent NULL dereference during probe
authorAndreas Noever <andreas.noever@gmail.com>
Tue, 16 Sep 2014 21:16:02 +0000 (15:16 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 14 Dec 2014 16:23:42 +0000 (16:23 +0000)
commit5581d5a5ad8bde5d8be7f1342d01f74c66b75efc
tree5980be7b944e0cbf5f185efd9389e76772eae132
parent2f3007855abfd0a7b9ac0925b20bbf972cc0e347
PCI: pciehp: Prevent NULL dereference during probe

commit bceee4a97eb58bd0e80e39eff11b506ddd9e7ad3 upstream.

pciehp assumes that dev->subordinate, the struct pci_bus for a bridge's
secondary bus, exists.  But we do not create that bus if we run out of bus
numbers during enumeration.  This leads to a NULL dereference in
init_slot() (and other places).

Change pciehp_probe() to return -ENODEV when no secondary bus is present.

Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/pci/hotplug/pciehp_core.c