浏览代码

mac80211: fix HW registration error paths

Station info state is started in allocation, so should be
destroyed on free (it's just a timer); rate control must
be freed if anything afterwards fails to initialize.

LED exit should be later, no need for locking there, but
it needs to be done also when rate init failed.

Also clean up the code by moving a label so the locking
doesn't have to be done separately.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg 10 年之前
父节点
当前提交
54330bf63b
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      net/mac80211/main.c

+ 6 - 6
net/mac80211/main.c

@@ -1041,10 +1041,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 		ieee80211_max_network_latency;
 		ieee80211_max_network_latency;
 	result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY,
 	result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY,
 				     &local->network_latency_notifier);
 				     &local->network_latency_notifier);
-	if (result) {
-		rtnl_lock();
+	if (result)
 		goto fail_pm_qos;
 		goto fail_pm_qos;
-	}
 
 
 #ifdef CONFIG_INET
 #ifdef CONFIG_INET
 	local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
 	local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
@@ -1072,15 +1070,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
  fail_ifa:
  fail_ifa:
 	pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
 	pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
 			       &local->network_latency_notifier);
 			       &local->network_latency_notifier);
-	rtnl_lock();
 #endif
 #endif
  fail_pm_qos:
  fail_pm_qos:
-	ieee80211_led_exit(local);
+	rtnl_lock();
+	rate_control_deinitialize(local);
 	ieee80211_remove_interfaces(local);
 	ieee80211_remove_interfaces(local);
  fail_rate:
  fail_rate:
 	rtnl_unlock();
 	rtnl_unlock();
+	ieee80211_led_exit(local);
 	ieee80211_wep_free(local);
 	ieee80211_wep_free(local);
-	sta_info_stop(local);
 	destroy_workqueue(local->workqueue);
 	destroy_workqueue(local->workqueue);
  fail_workqueue:
  fail_workqueue:
 	wiphy_unregister(local->hw.wiphy);
 	wiphy_unregister(local->hw.wiphy);
@@ -1176,6 +1174,8 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)
 
 
 	kfree(rcu_access_pointer(local->tx_latency));
 	kfree(rcu_access_pointer(local->tx_latency));
 
 
+	sta_info_stop(local);
+
 	wiphy_free(local->hw.wiphy);
 	wiphy_free(local->hw.wiphy);
 }
 }
 EXPORT_SYMBOL(ieee80211_free_hw);
 EXPORT_SYMBOL(ieee80211_free_hw);