Bug 193411
Summary: | ASPM NULL pointer dereference with PCIe reverse bridge | ||
---|---|---|---|
Product: | Drivers | Reporter: | Bjorn Helgaas (bjorn) |
Component: | PCI | Assignee: | drivers_pci (drivers_pci) |
Status: | NEW --- | ||
Severity: | normal | CC: | hjl.tools |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | https://bugzilla.opensuse.org/show_bug.cgi?id=1022181 | ||
Kernel Version: | v4.9-rc5 | Subsystem: | |
Regression: | Yes | Bisected commit-id: | |
Attachments: |
dmesg log
lspci -vv output disassembly of pcie_aspm_init_link_state() Test patch |
Description
Bjorn Helgaas
2017-01-27 23:05:33 UTC
This worked in an older SUSE kernel, 4.9.5-3.1.g9bb1a8a-default, so this is a regression. Submitter confirmed that reverting 51ebfc92b72b ("PCI: Enumerate switches below PCI-to-PCIe bridges") fixed it. Created attachment 253331 [details]
lspci -vv output
Created attachment 253341 [details]
disassembly of pcie_aspm_init_link_state()
Analysis showing the NULL pointer is pdev->bus->parent->self->link_state in the following code:
static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
{
struct pcie_link_state *link;
link = kzalloc(sizeof(*link), GFP_KERNEL);
if (!link)
return NULL;
INIT_LIST_HEAD(&link->sibling);
INIT_LIST_HEAD(&link->children);
INIT_LIST_HEAD(&link->link);
link->pdev = pdev;
if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) {
struct pcie_link_state *parent;
parent = pdev->bus->parent->self->link_state;
In this case, pdev is 03:00.0, the PCI-to-PCIe bridge. pdev->bus is bus 03, so pdev->bus->parent should be bus 00, and either pdev->bus->parent->self (the bridge to bus 00) is probably NULL. If ->self is not NULL, ->link_state is certainly NULL because everything above 03:00.0 is conventional PCI, not PCIe.
Created attachment 253351 [details]
Test patch
Test patch. This applies to v4.10-rc5.
(In reply to Bjorn Helgaas from comment #4) > Created attachment 253351 [details] > Test patch > > Test patch. This applies to v4.10-rc5. This fixed kernel 4.9.6 kernel panic on Intel S5520SC. |