diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-10-27 06:56:06 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-10-29 11:33:37 -0400 |
commit | 10b68487869031828aede7313c2befc53d6d30ec (patch) | |
tree | a22823db8ec5da2567d245c9438e8e5c38283112 /net | |
parent | 805dbe17d1c832ad341f14fae8cedf41b67ca6fa (diff) |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/iface.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index af237223a8cd..3b9e2b7b3f30 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -898,6 +898,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
898 | list_del(&sdata->u.vlan.list); | 898 | list_del(&sdata->u.vlan.list); |
899 | mutex_unlock(&local->mtx); | 899 | mutex_unlock(&local->mtx); |
900 | RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); | 900 | RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); |
901 | /* see comment in the default case below */ | ||
902 | ieee80211_free_keys(sdata, true); | ||
901 | /* no need to tell driver */ | 903 | /* no need to tell driver */ |
902 | break; | 904 | break; |
903 | case NL80211_IFTYPE_MONITOR: | 905 | case NL80211_IFTYPE_MONITOR: |
@@ -923,17 +925,16 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
923 | /* | 925 | /* |
924 | * When we get here, the interface is marked down. | 926 | * When we get here, the interface is marked down. |
925 | * Free the remaining keys, if there are any | 927 | * 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) | ||
927 | * | 931 | * |
928 | * Force the key freeing to always synchronize_net() | 932 | * Force the key freeing to always synchronize_net() |
929 | * to wait for the RX path in case it is using this | 933 | * 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 |
931 | * another CPU. | 935 | * another CPU. |
932 | */ | 936 | */ |
933 | ieee80211_free_keys(sdata, true); | 937 | ieee80211_free_keys(sdata, true); |
934 | |||
935 | /* fall through */ | ||
936 | case NL80211_IFTYPE_AP: | ||
937 | skb_queue_purge(&sdata->skb_queue); | 938 | skb_queue_purge(&sdata->skb_queue); |
938 | } | 939 | } |
939 | 940 | ||