]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/mac80211/sta_info.c
mac80211: batch key free synchronize_net()
[karo-tx-linux.git] / net / mac80211 / sta_info.c
index 2961f3d6b209c19fe2c1284b2dbc92b0186bdfe7..11216bc13b27565a4734638014ad01f5d2d88911 100644 (file)
@@ -783,7 +783,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
 {
        struct ieee80211_local *local;
        struct ieee80211_sub_if_data *sdata;
-       int ret, i;
+       int ret;
 
        might_sleep();
 
@@ -810,14 +810,8 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
 
        list_del_rcu(&sta->list);
 
-       mutex_lock(&local->key_mtx);
-       for (i = 0; i < NUM_DEFAULT_KEYS; i++)
-               ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]),
-                                  true);
-       if (sta->ptk)
-               ieee80211_key_free(key_mtx_dereference(local, sta->ptk),
-                                  true);
-       mutex_unlock(&local->key_mtx);
+       /* this always calls synchronize_net() */
+       ieee80211_free_sta_keys(local, sta);
 
        sta->dead = true;