On Thu, 2013-03-07 at 11:27 +0100, Johannes Berg wrote: > void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata) > { > struct ieee80211_key *key, *tmp; > + LIST_HEAD(keys); > > cancel_delayed_work_sync(&sdata->dec_tailroom_needed_wk); > > @@ -571,17 +578,61 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata) > > ieee80211_debugfs_key_remove_mgmt_default(sdata); > > - list_for_each_entry_safe(key, tmp, &sdata->key_list, list) > - ieee80211_key_free(key, false); > + list_for_each_entry_safe(key, tmp, &sdata->key_list, list) { > + ieee80211_key_replace(key->sdata, key->sta, > + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, > + key, NULL); > + list_add_tail(&key->list, &keys); > + } > > ieee80211_debugfs_key_update_default(sdata); > > + synchronize_net(); > + list_for_each_entry_safe(key, tmp, &keys, list) > + __ieee80211_key_destroy(key, false); Since it's likely that there are no keys, I'll change this: ieee80211_debugfs_key_update_default(sdata); - synchronize_net(); - list_for_each_entry_safe(key, tmp, &keys, list) - __ieee80211_key_destroy(key, false); + if (!list_empty(&keys)) { + synchronize_net(); + list_for_each_entry_safe(key, tmp, &keys, list) + __ieee80211_key_destroy(key, false); + } WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt || sdata->crypto_tx_tailroom_pending_dec); johannes -- 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