diff options
author | Yinghai Lu <yinghai@kernel.org> | 2014-10-30 12:17:25 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-11-05 15:06:16 -0500 |
commit | 32f638fc11db0526c706454d9ab4339d55ac89f3 (patch) | |
tree | ba1c8cb242be66e6850397e3f4a47c75dca5b7fd /include/linux/pci-acpi.h | |
parent | d8e7d53a2fc14e0830ab728cb84ee19933d3ac8d (diff) |
PCI: Don't oops on virtual buses in acpi_pci_get_bridge_handle()
acpi_pci_get_bridge_handle() returns the ACPI handle for the bridge device
(either a host bridge or a PCI-to-PCI bridge) leading to a PCI bus. But
SR-IOV virtual functions can be on a virtual bus with no bridge leading to
it. Return a NULL acpi_handle in this case instead of trying to
dereference the NULL pointer to the bridge.
This fixes a NULL pointer dereference oops in pci_get_hp_params() when
adding SR-IOV VF devices on virtual buses.
[bhelgaas: changelog, add comment in code]
Fixes: 6cd33649fa83 ("PCI: Add pci_configure_device() during enumeration")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=87591
Reported-by: Chao Zhou <chao.zhou@intel.com>
Reported-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include/linux/pci-acpi.h')
-rw-r--r-- | include/linux/pci-acpi.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 64dacb7288a6..24c7728ca681 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -41,8 +41,13 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | |||
41 | 41 | ||
42 | if (pci_is_root_bus(pbus)) | 42 | if (pci_is_root_bus(pbus)) |
43 | dev = pbus->bridge; | 43 | dev = pbus->bridge; |
44 | else | 44 | else { |
45 | /* If pbus is a virtual bus, there is no bridge to it */ | ||
46 | if (!pbus->self) | ||
47 | return NULL; | ||
48 | |||
45 | dev = &pbus->self->dev; | 49 | dev = &pbus->self->dev; |
50 | } | ||
46 | 51 | ||
47 | return ACPI_HANDLE(dev); | 52 | return ACPI_HANDLE(dev); |
48 | } | 53 | } |