lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 26 May 2013 23:53:16 +0800
From:	Jiang Liu <liuj97@...il.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>,
	Yinghai Lu <yinghai@...nel.org>
Cc:	Jiang Liu <jiang.liu@...wei.com>,
	"Rafael J . Wysocki" <rjw@...k.pl>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Gu Zheng <guz.fnst@...fujitsu.com>,
	Toshi Kani <toshi.kani@...com>,
	Myron Stowe <myron.stowe@...hat.com>,
	Yijing Wang <wangyijing@...wei.com>,
	Jiang Liu <liuj97@...il.com>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Corentin Chary <corentin.chary@...il.com>,
	Matthew Garrett <matthew.garrett@...ula.com>,
	acpi4asus-user@...ts.sourceforge.net,
	platform-driver-x86@...r.kernel.org
Subject: [PATCH v3, part2 19/20] PCI, asus-wmi: use hotplug-safe iterators to walk PCI buses

Enhance asus-wmi drvier to use hotplug-safe iterators to walk PCI buses.

Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
Cc: Corentin Chary <corentin.chary@...il.com>
Cc: Matthew Garrett <matthew.garrett@...ula.com>
Cc: acpi4asus-user@...ts.sourceforge.net
Cc: platform-driver-x86@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
---
 drivers/platform/x86/asus-wmi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index c11b242..f92db4c 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -596,7 +596,7 @@ static bool asus_wlan_rfkill_blocked(struct asus_wmi *asus)
 static void asus_rfkill_hotplug(struct asus_wmi *asus)
 {
 	struct pci_dev *dev;
-	struct pci_bus *bus;
+	struct pci_bus *bus = NULL;
 	bool blocked;
 	bool absent;
 	u32 l;
@@ -611,7 +611,7 @@ static void asus_rfkill_hotplug(struct asus_wmi *asus)
 		rfkill_set_sw_state(asus->wlan.rfkill, blocked);
 
 	if (asus->hotplug_slot) {
-		bus = pci_find_bus(0, 1);
+		bus = pci_get_bus(0, 1);
 		if (!bus) {
 			pr_warn("Unable to find PCI bus 1?\n");
 			goto out_unlock;
@@ -657,6 +657,7 @@ static void asus_rfkill_hotplug(struct asus_wmi *asus)
 
 out_unlock:
 	mutex_unlock(&asus->hotplug_lock);
+	pci_bus_put(bus);
 }
 
 static void asus_rfkill_notify(acpi_handle handle, u32 event, void *data)
@@ -748,7 +749,7 @@ static void asus_hotplug_work(struct work_struct *work)
 static int asus_setup_pci_hotplug(struct asus_wmi *asus)
 {
 	int ret = -ENOMEM;
-	struct pci_bus *bus = pci_find_bus(0, 1);
+	struct pci_bus *bus = pci_get_bus(0, 1);
 
 	if (!bus) {
 		pr_err("Unable to find wifi PCI bus\n");
@@ -782,6 +783,7 @@ static int asus_setup_pci_hotplug(struct asus_wmi *asus)
 		pr_err("Unable to register hotplug slot - %d\n", ret);
 		goto error_register;
 	}
+	pci_bus_put(bus);
 
 	return 0;
 
@@ -793,6 +795,7 @@ error_info:
 error_slot:
 	destroy_workqueue(asus->hotplug_workqueue);
 error_workqueue:
+	pci_bus_put(bus);
 	return ret;
 }
 
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists