aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/sta_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/sta_info.c')
-rw-r--r--net/mac80211/sta_info.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 3644ad79688a..85458a28ffa0 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -771,6 +771,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
771 struct ieee80211_local *local; 771 struct ieee80211_local *local;
772 struct ieee80211_sub_if_data *sdata; 772 struct ieee80211_sub_if_data *sdata;
773 int ret, i; 773 int ret, i;
774 bool have_key = false;
774 775
775 might_sleep(); 776 might_sleep();
776 777
@@ -798,14 +799,22 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
798 list_del_rcu(&sta->list); 799 list_del_rcu(&sta->list);
799 800
800 mutex_lock(&local->key_mtx); 801 mutex_lock(&local->key_mtx);
801 for (i = 0; i < NUM_DEFAULT_KEYS; i++) 802 for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
802 __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]), 803 __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]),
803 true); 804 true);
804 if (sta->ptk) 805 have_key = true;
806 }
807 if (sta->ptk) {
805 __ieee80211_key_free(key_mtx_dereference(local, sta->ptk), 808 __ieee80211_key_free(key_mtx_dereference(local, sta->ptk),
806 true); 809 true);
810 have_key = true;
811 }
812
807 mutex_unlock(&local->key_mtx); 813 mutex_unlock(&local->key_mtx);
808 814
815 if (!have_key)
816 synchronize_net();
817
809 sta->dead = true; 818 sta->dead = true;
810 819
811 local->num_sta--; 820 local->num_sta--;