]> git.baikalelectronics.ru Git - kernel.git/commit
PCI / ACPI: Do not set ACPI companions for host bridges with parents
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 27 May 2015 23:39:53 +0000 (01:39 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 27 May 2015 23:39:53 +0000 (01:39 +0200)
commite18754569188e1c88e203cfc62a6f65146c40ea4
treee6eaba2f03f568e051b0be16211f7160db0eaaea
parenta76c242610dba259428276f7f2572730e8431bae
PCI / ACPI: Do not set ACPI companions for host bridges with parents

Commit ca3a32f6a229 (device property: Make it possible to use
secondary firmware nodes) uncovered a bug in the x86 (and ia64) PCI
host bridge initialization code that assumes bridge->bus->sysdata
to always point to a struct pci_sysdata object which need not be
the case (in particular, the Xen PCI frontend driver sets it to point
to a different data type).  If it is not the case, an incorrect
pointer (or a piece of data that is not a pointer at all) will be
passed to ACPI_COMPANION_SET() and that may cause interesting
breakage to happen going forward.

To work around this problem use the observation that the ACPI
host bridge initialization always passes NULL as parent to
pci_create_root_bus(), so if pcibios_root_bridge_prepare() sees
a non-NULL parent of the bridge, it should not attempt to set
an ACPI companion for it, because that means that
pci_create_root_bus() has been called by someone else.

Fixes: ca3a32f6a229 (device property: Make it possible to use secondary firmware nodes)
Reported-and-tested-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
arch/ia64/pci/pci.c
arch/x86/pci/acpi.c