Search Linux Wireless

[RTF] iwmc3200wifi: fix device registration ordering for cfg80211

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without this you can get a race against udev and userspace daemons
which will try to poke the device even before netdev ops and friends
are available. Device initialization will fail without this.

Cc: stable@xxxxxxxxxx
Cc: Naveen Singh <nsingh@xxxxxxxxxxx>
Cc: Wey-Yi Guy <wey-yi.w.guy@xxxxxxxxx>
Cc: Intel Linux Wireless <ilw@xxxxxxxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx>
---

I'm pretty sure this is correct, I noticed ath6kl followed the same path as
iwmc3200wifi and I spotted a bug on ath6kl with this path.. so I'm pretty damn
sure this bug is also present on iwmc3200wifi. Please test.

 drivers/net/wireless/iwmc3200wifi/cfg80211.c |    9 ---------
 drivers/net/wireless/iwmc3200wifi/netdev.c   |    6 ++++++
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index ed57e44..2f48f72 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -837,17 +837,8 @@ struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev)
 	wdev->wiphy->cipher_suites = cipher_suites;
 	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
 
-	ret = wiphy_register(wdev->wiphy);
-	if (ret < 0) {
-		dev_err(dev, "Couldn't register wiphy device\n");
-		goto out_err_register;
-	}
-
 	return wdev;
 
- out_err_register:
-	wiphy_free(wdev->wiphy);
-
  out_err_new:
 	kfree(wdev);
 
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c
index 5091d77..731058e 100644
--- a/drivers/net/wireless/iwmc3200wifi/netdev.c
+++ b/drivers/net/wireless/iwmc3200wifi/netdev.c
@@ -145,6 +145,12 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
 
 	iwm_init_default_profile(iwm, iwm->umac_profile);
 
+	ret = wiphy_register(wdev->wiphy);
+	if (ret < 0) {
+		dev_err(dev, "Couldn't register wiphy device\n");
+		goto out_profile;
+	}
+
 	return iwm;
 
  out_profile:
-- 
1.7.4.15.g7811d

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


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux