From: Johannes Berg The only reason for the force_synchronize here was for some callers to amortize their own synchronize_rcu() with the one required for keys, but keys no longer require one. Clean up the argument. It seems like this should require some callers to call it themselves, but the original user was do_stop(), which now has its own (again) anyway to ensure no frames go to the SKB queue before purging it. See commit 7907c7d33c37 ("mac80211: free all AP/VLAN keys at once") for the move into key code. The other callers (AP_VLAN, NAN, mesh) didn't really care at all, so we can just drop the argument. Assisted-by: LLM Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/iface.c | 14 ++++---------- net/mac80211/key.c | 5 +---- net/mac80211/key.h | 3 +-- net/mac80211/mesh.c | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 581a5d57e560..8bfd6bc9c9fe 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -614,8 +614,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do case NL80211_IFTYPE_AP_VLAN: list_del(&sdata->u.vlan.list); RCU_INIT_POINTER(sdata->vif.bss_conf.chanctx_conf, NULL); - /* see comment in the default case below */ - ieee80211_free_keys(sdata, true); + ieee80211_free_keys(sdata); /* increased by AP value on ifup, so reset on ifdown */ sdata->crypto_tx_tailroom_needed_cnt = 0; /* no need to tell driver */ @@ -662,7 +661,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do * Free the remaining keys that might be associated with the * NAN interface, e.g., IGTK and BIGTK used for Tx. */ - ieee80211_free_keys(sdata, true); + ieee80211_free_keys(sdata); break; case NL80211_IFTYPE_NAN_DATA: RCU_INIT_POINTER(sdata->u.nan_data.nmi, NULL); @@ -674,13 +673,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do * Free the remaining keys, if there are any * (which can happen in AP mode if userspace sets * keys before the interface is operating) - * - * Force the key freeing to always synchronize_net() - * to wait for the RX path in case it is using this - * interface enqueuing frames at this very time on - * another CPU. */ - ieee80211_free_keys(sdata, true); + ieee80211_free_keys(sdata); skb_queue_purge(&sdata->skb_queue); skb_queue_purge(&sdata->status_queue); } @@ -906,7 +900,7 @@ static void ieee80211_teardown_sdata(struct ieee80211_sub_if_data *sdata) wiphy_work_cancel(sdata->local->hw.wiphy, &sdata->work); /* free extra data */ - ieee80211_free_keys(sdata, false); + ieee80211_free_keys(sdata); ieee80211_debugfs_remove_netdev(sdata); diff --git a/net/mac80211/key.c b/net/mac80211/key.c index b66168edab25..d1e3fe37d2e3 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -1229,8 +1229,7 @@ void ieee80211_free_key_list(struct ieee80211_local *local, ieee80211_key_destroy(key); } -void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, - bool force_synchronize) +void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata) { struct ieee80211_local *local = sdata->local; struct ieee80211_sub_if_data *vlan; @@ -1252,8 +1251,6 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, WARN_ON(!list_empty(&sdata->key_list)); - if (force_synchronize) - synchronize_net(); list_for_each_entry_safe(key, tmp, &keys, list) ieee80211_key_destroy(key); diff --git a/net/mac80211/key.h b/net/mac80211/key.h index b7afd6c90eb0..9f13d175623a 100644 --- a/net/mac80211/key.h +++ b/net/mac80211/key.h @@ -205,8 +205,7 @@ void ieee80211_remove_link_keys(struct ieee80211_link_data *link, struct list_head *keys); void ieee80211_free_key_list(struct ieee80211_local *local, struct list_head *keys); -void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, - bool force_synchronize); +void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata); void ieee80211_unlink_link_sta_keys(struct ieee80211_local *local, struct link_sta_info *link_sta); void ieee80211_free_sta_keys(struct ieee80211_local *local, diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 8f8814125375..5f523e14cf84 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -1226,7 +1226,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) /* flush STAs and mpaths on this iface */ sta_info_flush(sdata, -1); - ieee80211_free_keys(sdata, true); + ieee80211_free_keys(sdata); mesh_path_flush_by_iface(sdata); /* stop the beacon */ -- 2.56.0