• Jiang Liu's avatar
    PCI: acpiphp: Protect acpiphp data structures from concurrent updates · 3d54a316
    Jiang Liu authored
    Now acpiphp_enumerate_slots() and acpiphp_remove_slots() may be invoked
    concurrently by the PCI core, so add a bridge_mutex and reference count
    mechanism to protect acpiphp bridge/slot/function data structures.
    
    To avoid deadlock, handle_hotplug_event_bridge() will requeue the
    hotplug event onto the kacpi_hotplug_wq by calling alloc_acpi_hp_work().
    But the workaround has introduced a minor race window because the
    'bridge' passed to _handle_hotplug_event_bridge() may have already been
    destroyed when _handle_hotplug_event_bridge() is actually executed by
    the kacpi_hotplug_wq.  So hold a reference count on the passed 'bridge'.
    Fix the same issue for handle_hotplug_event_func() too.
    Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
    Signed-off-by: default avatarYijing Wang <wangyijing@huawei.com>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: default avatarYinghai Lu <yinghai@kernel.org>
    Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
    Cc: Toshi Kani <toshi.kani@hp.com>
    3d54a316
acpiphp_glue.c 31.4 KB