aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-03-31 13:23:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:14:10 -0400
commit4f6fab472c4c7c21d577f85fabec7628d4a05637 (patch)
tree0949dffadb0b715053e4d7148ebcabe930b39361 /net
parent93e5deb1ae39b56f4743955e76c72251256f23c1 (diff)
mac80211: clean up sta_info_destroy() users wrt. RCU/locking
Calling sta_info_destroy() doesn't require RCU-synchronisation before-hand because it does that internally. However, it does require rtnl-locking so insert that where necessary. Also clean up the code doing it internally to be a bit clearer and not synchronize twice if keys are configured. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c6
-rw-r--r--net/mac80211/ieee80211_sta.c1
-rw-r--r--net/mac80211/sta_info.c33
3 files changed, 20 insertions, 20 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index fbd462c78e18..5f8db5cab65d 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -700,11 +700,7 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
700 return -ENOENT; 700 return -ENOENT;
701 701
702 sta_info_unlink(&sta); 702 sta_info_unlink(&sta);
703 703 sta_info_destroy(sta);
704 if (sta) {
705 synchronize_rcu();
706 sta_info_destroy(sta);
707 }
708 } else 704 } else
709 sta_info_flush(local, sdata); 705 sta_info_flush(local, sdata);
710 706
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 00fde111c268..c5a47f8d873a 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -939,7 +939,6 @@ static void ieee80211_associated(struct net_device *dev,
939 rcu_read_unlock(); 939 rcu_read_unlock();
940 940
941 if (disassoc && sta) { 941 if (disassoc && sta) {
942 synchronize_rcu();
943 rtnl_lock(); 942 rtnl_lock();
944 sta_info_destroy(sta); 943 sta_info_destroy(sta);
945 rtnl_unlock(); 944 rtnl_unlock();
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 5497ca1843fe..dfca96e05d69 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -180,13 +180,22 @@ void sta_info_destroy(struct sta_info *sta)
180 mesh_plink_deactivate(sta); 180 mesh_plink_deactivate(sta);
181#endif 181#endif
182 182
183 /* 183 if (sta->key) {
184 * NOTE: This will call synchronize_rcu() internally to 184 /*
185 * make sure no key references can be in use. We rely on 185 * NOTE: This will call synchronize_rcu() internally to
186 * that here for the mesh code! 186 * make sure no key references can be in use. We rely on
187 */ 187 * that when we take this branch to make sure nobody can
188 ieee80211_key_free(sta->key); 188 * reference this STA struct any longer!
189 WARN_ON(sta->key); 189 */
190 ieee80211_key_free(sta->key);
191 WARN_ON(sta->key);
192 } else {
193 /*
194 * Make sure that nobody can reference this STA struct
195 * any longer.
196 */
197 synchronize_rcu();
198 }
190 199
191#ifdef CONFIG_MAC80211_MESH 200#ifdef CONFIG_MAC80211_MESH
192 if (ieee80211_vif_is_mesh(&sta->sdata->vif)) 201 if (ieee80211_vif_is_mesh(&sta->sdata->vif))
@@ -628,11 +637,9 @@ static void sta_info_debugfs_add_work(struct work_struct *work)
628 rate_control_add_sta_debugfs(sta); 637 rate_control_add_sta_debugfs(sta);
629 638
630 sta = __sta_info_unpin(sta); 639 sta = __sta_info_unpin(sta);
631 640 rtnl_lock();
632 if (sta) { 641 sta_info_destroy(sta);
633 synchronize_rcu(); 642 rtnl_unlock();
634 sta_info_destroy(sta);
635 }
636 } 643 }
637} 644}
638#endif 645#endif
@@ -694,8 +701,6 @@ int sta_info_flush(struct ieee80211_local *local,
694 } 701 }
695 spin_unlock_irqrestore(&local->sta_lock, flags); 702 spin_unlock_irqrestore(&local->sta_lock, flags);
696 703
697 synchronize_rcu();
698
699 list_for_each_entry_safe(sta, tmp, &tmp_list, list) 704 list_for_each_entry_safe(sta, tmp, &tmp_list, list)
700 sta_info_destroy(sta); 705 sta_info_destroy(sta);
701 706