]> git.baikalelectronics.ru Git - kernel.git/commit
PCI/ASPM: Deal with missing root ports in link state handling
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 2 Oct 2017 14:08:40 +0000 (15:08 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 5 Oct 2017 20:50:02 +0000 (15:50 -0500)
commit59f4004585daf84fbdaa28be04b4b82a0c99b43d
tree4cc5fc3d25e66c78495c722dd229411e92d0ba6e
parentb888c937506147d5d77f24afb038b53ae6e1b4f2
PCI/ASPM: Deal with missing root ports in link state handling

Even though it is unconventional, some PCIe host implementations omit the
root ports entirely, and simply consist of a host bridge (which is not
modeled as a device in the PCI hierarchy) and a link.

When the downstream device is an endpoint, our current code does not seem
to mind this unusual configuration. However, when PCIe switches are
involved, the ASPM code assumes that any downstream switch port has a
parent, and blindly dereferences the bus->parent->self field of the pci_dev
struct to chain the downstream link state to the link state of the root
port. Given that the root port is missing, the link is not modeled at all,
and nor is the link state, and attempting to access it results in a NULL
pointer dereference and a crash.

Avoid this by allowing the link state chain to terminate at the downstream
port if no root port exists.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pcie/aspm.c