]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: remove keys after disabling beaconing
authorJohannes Berg <johannes.berg@intel.com>
Tue, 3 Mar 2026 14:03:39 +0000 (15:03 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 6 Mar 2026 10:06:14 +0000 (11:06 +0100)
We shouldn't remove keys before disable beaconing, at least when
beacon protection is used, since that would remove keys that are
still used for beacon transmission at the same time. Stop before
removing keys so there's no race.

Fixes: af2d14b01c32 ("mac80211: Beacon protection using the new BIGTK (STA)")
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260303150339.574e7887b3ab.I50d708f5aa22584506a91d0da7f8a73ba39fceac@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c

index b92b4a5c2636d8f819fbe45ee4dc34665e4ee6e4..b85375ceb575d7749a546af9ecec9875483cfb60 100644 (file)
@@ -1904,12 +1904,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
 
        __sta_info_flush(sdata, true, link_id, NULL);
 
-       ieee80211_remove_link_keys(link, &keys);
-       if (!list_empty(&keys)) {
-               synchronize_net();
-               ieee80211_free_key_list(local, &keys);
-       }
-
        ieee80211_stop_mbssid(sdata);
        RCU_INIT_POINTER(link_conf->tx_bss_conf, NULL);
 
@@ -1921,6 +1915,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
        ieee80211_link_info_change_notify(sdata, link,
                                          BSS_CHANGED_BEACON_ENABLED);
 
+       ieee80211_remove_link_keys(link, &keys);
+       if (!list_empty(&keys)) {
+               synchronize_net();
+               ieee80211_free_key_list(local, &keys);
+       }
+
        if (sdata->wdev.links[link_id].cac_started) {
                chandef = link_conf->chanreq.oper;
                wiphy_hrtimer_work_cancel(wiphy, &link->dfs_cac_timer_work);