Commit 804fc6a2 authored by Mathy Vanhoef's avatar Mathy Vanhoef Committed by Johannes Berg

mac80211: fix regression where EAPOL frames were sent in plaintext

When sending EAPOL frames via NL80211 they are treated as injected
frames in mac80211. Due to commit 1df2bdba ("mac80211: never drop
injected frames even if normally not allowed") these injected frames
were not assigned a sta context in the function ieee80211_tx_dequeue,
causing certain wireless network cards to always send EAPOL frames in
plaintext. This may cause compatibility issues with some clients or
APs, which for instance can cause the group key handshake to fail and
in turn would cause the station to get disconnected.

This commit fixes this regression by assigning a sta context in
ieee80211_tx_dequeue to injected frames as well.

Note that sending EAPOL frames in plaintext is not a security issue
since they contain their own encryption and authentication protection.

Cc: stable@vger.kernel.org
Fixes: 1df2bdba ("mac80211: never drop injected frames even if normally not allowed")
Reported-by: default avatarThomas Deutschmann <whissi@gentoo.org>
Tested-by: default avatarChristian Hesse <list@eworm.de>
Tested-by: default avatarThomas Deutschmann <whissi@gentoo.org>
Signed-off-by: default avatarMathy Vanhoef <Mathy.Vanhoef@kuleuven.be>
Link: https://lore.kernel.org/r/20201019160113.350912-1-Mathy.Vanhoef@kuleuven.beSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 07e08873
...@@ -3619,13 +3619,14 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, ...@@ -3619,13 +3619,14 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
tx.skb = skb; tx.skb = skb;
tx.sdata = vif_to_sdata(info->control.vif); tx.sdata = vif_to_sdata(info->control.vif);
if (txq->sta && !(info->flags & IEEE80211_TX_CTL_INJECTED)) { if (txq->sta) {
tx.sta = container_of(txq->sta, struct sta_info, sta); tx.sta = container_of(txq->sta, struct sta_info, sta);
/* /*
* Drop unicast frames to unauthorised stations unless they are * Drop unicast frames to unauthorised stations unless they are
* EAPOL frames from the local station. * injected frames or EAPOL frames from the local station.
*/ */
if (unlikely(ieee80211_is_data(hdr->frame_control) && if (unlikely(!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
ieee80211_is_data(hdr->frame_control) &&
!ieee80211_vif_is_mesh(&tx.sdata->vif) && !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
tx.sdata->vif.type != NL80211_IFTYPE_OCB && tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
!is_multicast_ether_addr(hdr->addr1) && !is_multicast_ether_addr(hdr->addr1) &&
......
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