Skip to content

Commit 10b6848

Browse files
Felix Fietkaujmberg-intel
authored andcommitted
mac80211: flush keys for AP mode on ieee80211_do_stop
Userspace can add keys to an AP mode interface before start_ap has been called. If there have been no calls to start_ap/stop_ap in the mean time, the keys will still be around when the interface is brought down. Signed-off-by: Felix Fietkau <nbd@openwrt.org> [adjust comments, fix AP_VLAN case] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 805dbe1 commit 10b6848

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎net/mac80211/iface.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
898898
list_del(&sdata->u.vlan.list);
899899
mutex_unlock(&local->mtx);
900900
RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL);
901+
/* see comment in the default case below */
902+
ieee80211_free_keys(sdata, true);
901903
/* no need to tell driver */
902904
break;
903905
case NL80211_IFTYPE_MONITOR:
@@ -923,17 +925,16 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
923925
/*
924926
* When we get here, the interface is marked down.
925927
* Free the remaining keys, if there are any
926-
* (shouldn't be, except maybe in WDS mode?)
928+
* (which can happen in AP mode if userspace sets
929+
* keys before the interface is operating, and maybe
930+
* also in WDS mode)
927931
*
928932
* Force the key freeing to always synchronize_net()
929933
* to wait for the RX path in case it is using this
930-
* interface enqueuing frames * at this very time on
934+
* interface enqueuing frames at this very time on
931935
* another CPU.
932936
*/
933937
ieee80211_free_keys(sdata, true);
934-
935-
/* fall through */
936-
case NL80211_IFTYPE_AP:
937938
skb_queue_purge(&sdata->skb_queue);
938939
}
939940

0 commit comments

Comments
 (0)