wifi: mac80211: remove only link keys during stopping link AP
authorRameshkumar Sundaram <quic_ramess@quicinc.com>
Tue, 27 Feb 2024 04:22:50 +0000 (09:52 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 4 Mar 2024 13:28:59 +0000 (14:28 +0100)
Currently while stopping a link AP, all keys from the interface were
removed. However with MLO there is a requirement to free only the link
keys.

Add changes to remove keys which are associated with the link AP which is
going to be stopped.

Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://msgid.link/20240227042251.1511122-2-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c

index 3aa96898a250d224d22059af95f3dc9b9b10b9a6..bc0c1300e4047c6bb1520b96b639ad94459c9dd3 100644 (file)
@@ -1563,6 +1563,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
        struct ieee80211_link_data *link =
                sdata_dereference(sdata->link[link_id], sdata);
        struct ieee80211_bss_conf *link_conf = link->conf;
+       LIST_HEAD(keys);
 
        lockdep_assert_wiphy(local->hw.wiphy);
 
@@ -1617,7 +1618,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
        link_conf->bssid_indicator = 0;
 
        __sta_info_flush(sdata, true, link_id);
-       ieee80211_free_keys(sdata, true);
+
+       ieee80211_remove_link_keys(link, &keys);
+       if (!list_empty(&keys)) {
+               synchronize_net();
+               ieee80211_free_key_list(local, &keys);
+       }
 
        link_conf->enable_beacon = false;
        sdata->beacon_rate_set = false;