Commit 4ea96747 authored by Jouni Malinen's avatar Jouni Malinen Committed by Khalid Elmously

mac80211: Do not send Layer 2 Update frame before authorization

BugLink: https://bugs.launchpad.net/bugs/1860681

commit 3e493173 upstream.

The Layer 2 Update frame is used to update bridges when a station roams
to another AP even if that STA does not transmit any frames after the
reassociation. This behavior was described in IEEE Std 802.11F-2003 as
something that would happen based on MLME-ASSOCIATE.indication, i.e.,
before completing 4-way handshake. However, this IEEE trial-use
recommended practice document was published before RSN (IEEE Std
802.11i-2004) and as such, did not consider RSN use cases. Furthermore,
IEEE Std 802.11F-2003 was withdrawn in 2006 and as such, has not been
maintained amd should not be used anymore.

Sending out the Layer 2 Update frame immediately after association is
fine for open networks (and also when using SAE, FT protocol, or FILS
authentication when the station is actually authenticated by the time
association completes). However, it is not appropriate for cases where
RSN is used with PSK or EAP authentication since the station is actually
fully authenticated only once the 4-way handshake completes after
authentication and attackers might be able to use the unauthenticated
triggering of Layer 2 Update frame transmission to disrupt bridge
behavior.

Fix this by postponing transmission of the Layer 2 Update frame from
station entry addition to the point when the station entry is marked
authorized. Similarly, send out the VLAN binding update only if the STA
entry has already been authorized.
Signed-off-by: default avatarJouni Malinen <jouni@codeaurora.org>
Reviewed-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[bwh: Backported to 4.4: adjust context]
Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent e25532d3
...@@ -1150,7 +1150,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -1150,7 +1150,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
struct sta_info *sta; struct sta_info *sta;
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
int err; int err;
int layer2_update;
if (params->vlan) { if (params->vlan) {
sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
...@@ -1204,18 +1203,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -1204,18 +1203,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
test_sta_flag(sta, WLAN_STA_ASSOC)) test_sta_flag(sta, WLAN_STA_ASSOC))
rate_control_rate_init(sta); rate_control_rate_init(sta);
layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
sdata->vif.type == NL80211_IFTYPE_AP;
err = sta_info_insert_rcu(sta); err = sta_info_insert_rcu(sta);
if (err) { if (err) {
rcu_read_unlock(); rcu_read_unlock();
return err; return err;
} }
if (layer2_update)
cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
rcu_read_unlock(); rcu_read_unlock();
return 0; return 0;
...@@ -1323,7 +1316,9 @@ static int ieee80211_change_station(struct wiphy *wiphy, ...@@ -1323,7 +1316,9 @@ static int ieee80211_change_station(struct wiphy *wiphy,
atomic_inc(&sta->sdata->bss->num_mcast_sta); atomic_inc(&sta->sdata->bss->num_mcast_sta);
} }
cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr); if (sta->sta_state == IEEE80211_STA_AUTHORIZED)
cfg80211_send_layer2_update(sta->sdata->dev,
sta->sta.addr);
} }
err = sta_apply_parameters(local, sta, params); err = sta_apply_parameters(local, sta, params);
......
...@@ -1775,6 +1775,10 @@ int sta_info_move_state(struct sta_info *sta, ...@@ -1775,6 +1775,10 @@ int sta_info_move_state(struct sta_info *sta,
set_bit(WLAN_STA_AUTHORIZED, &sta->_flags); set_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
ieee80211_check_fast_xmit(sta); ieee80211_check_fast_xmit(sta);
} }
if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
sta->sdata->vif.type == NL80211_IFTYPE_AP)
cfg80211_send_layer2_update(sta->sdata->dev,
sta->sta.addr);
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment