• Rafael J. Wysocki's avatar
    PCI / ACPI: Do not set ACPI companions for host bridges with parents · dc4fdaf0
    Rafael J. Wysocki authored
    Commit 97badf87 (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: 97badf87 (device property: Make it possible to use secondary firmware nodes)
    Reported-and-tested-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    dc4fdaf0
acpi.c 13.5 KB