From patchwork Fri Jan 10 14:27:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 3466641 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C3725C02DC for ; Fri, 10 Jan 2014 14:19:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD4F120138 for ; Fri, 10 Jan 2014 14:19:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98B002012B for ; Fri, 10 Jan 2014 14:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757593AbaAJOTD (ORCPT ); Fri, 10 Jan 2014 09:19:03 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:49265 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752397AbaAJOQT (ORCPT ); Fri, 10 Jan 2014 09:16:19 -0500 Received: from afdq137.neoplus.adsl.tpnet.pl [95.49.94.137] (HELO vostro.rjw.lan) by serwer1319399.home.pl [79.96.170.134] with SMTP (IdeaSmtpServer v0.80) id e97a18598b3d304d; Fri, 10 Jan 2014 15:16:17 +0100 From: "Rafael J. Wysocki" To: Bjorn Helgaas Cc: Yinghai Lu , "Rafael J. Wysocki" , Gu Zheng , Guo Chao , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Mika Westerberg , Myron Stowe , Benjamin Herrenschmidt , linux-scsi@vger.kernel.org, Matthew Garrett , Konrad Rzeszutek Wilk Subject: [PATCH 6/9] platform / x86: Use global PCI rescan-remove locking Date: Fri, 10 Jan 2014 15:27:08 +0100 Message-ID: <1493412.bZ2k5bhngZ@vostro.rjw.lan> User-Agent: KMail/4.11.3 (Linux/3.13.0-rc6+; KDE/4.11.3; x86_64; ; ) In-Reply-To: <20440867.YaQfKrcfsQ@vostro.rjw.lan> References: <1385429290-25397-1-git-send-email-yinghai@kernel.org> <1992931.Zv6xBcN8V4@vostro.rjw.lan> <20440867.YaQfKrcfsQ@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki 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 --- drivers/platform/x86/asus-wmi.c | 2 ++ drivers/platform/x86/eeepc-laptop.c | 2 ++ 2 files changed, 4 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }