From: Felix Fietkau Date: Sat, 29 Sep 2018 14:01:58 +0000 (+0200) Subject: mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys X-Git-Tag: v3.16.62~48 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=40b1b4e0aa2542ef68eec505ebcb07ff29527bb6;p=wrapfs-2.6.37.y.git mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys commit 211710ca74adf790b46ab3867fcce8047b573cd1 upstream. key->sta is only valid after ieee80211_key_link, which is called later in this function. Because of that, the IEEE80211_KEY_FLAG_RX_MGMT is never set when management frame protection is enabled. Fixes: e548c49e6dc6b ("mac80211: add key flag for management keys") Signed-off-by: Felix Fietkau Signed-off-by: Johannes Berg Signed-off-by: Ben Hutchings --- diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 4b1a0e5dd701..46d0ecf362bf 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -209,7 +209,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP_VLAN: /* Keys without a station are used for TX only */ - if (key->sta && test_sta_flag(key->sta, WLAN_STA_MFP)) + if (sta && test_sta_flag(sta, WLAN_STA_MFP)) key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; break; case NL80211_IFTYPE_ADHOC: