From: Rafael J. Wysocki <rafael.j.wyso...@intel.com>

Multiple race conditions are possible between the rfkill hotplug in
the asus-wmi and eeepc-laptop drivers and the generic PCI bus rescan
and device removal that can be triggered via sysfs.

To avoid those race conditions make asus-wmi and eeepc-laptop use
global PCI rescan-remove locking around the rfkill hotplug.

Signed-off-by: Rafael J. Wysocki <rafael.j.wyso...@intel.com>
---
 drivers/platform/x86/asus-wmi.c     |    2 ++
 drivers/platform/x86/eeepc-laptop.c |    2 ++
 2 files changed, 4 insertions(+)

Index: linux-pm/drivers/platform/x86/asus-wmi.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/asus-wmi.c
+++ linux-pm/drivers/platform/x86/asus-wmi.c
@@ -605,6 +605,7 @@ static void asus_rfkill_hotplug(struct a
        mutex_unlock(&asus->wmi_lock);
 
        mutex_lock(&asus->hotplug_lock);
+       pci_lock_rescan_remove();
 
        if (asus->wlan.rfkill)
                rfkill_set_sw_state(asus->wlan.rfkill, blocked);
@@ -655,6 +656,7 @@ static void asus_rfkill_hotplug(struct a
        }
 
 out_unlock:
+       pci_unlock_rescan_remove();
        mutex_unlock(&asus->hotplug_lock);
 }
 
Index: linux-pm/drivers/platform/x86/eeepc-laptop.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/eeepc-laptop.c
+++ linux-pm/drivers/platform/x86/eeepc-laptop.c
@@ -591,6 +591,7 @@ static void eeepc_rfkill_hotplug(struct
                rfkill_set_sw_state(eeepc->wlan_rfkill, blocked);
 
        mutex_lock(&eeepc->hotplug_lock);
+       pci_lock_rescan_remove();
 
        if (eeepc->hotplug_slot) {
                port = acpi_get_pci_dev(handle);
@@ -648,6 +649,7 @@ out_put_dev:
        }
 
 out_unlock:
+       pci_unlock_rescan_remove();
        mutex_unlock(&eeepc->hotplug_lock);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to