Commit 610d086d authored by Deren Wu's avatar Deren Wu Committed by Johannes Berg

mac80211: fix EAPoL rekey fail in 802.3 rx path

mac80211 set capability NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211
to upper layer by default. That means we should pass EAPoL packets through
nl80211 path only, and should not send the EAPoL skb to netdevice diretly.
At the meanwhile, wpa_supplicant would not register sock to listen EAPoL
skb on the netdevice.

However, there is no control_port_protocol handler in mac80211 for 802.3 RX
packets, mac80211 driver would pass up the EAPoL rekey frame to netdevice
and wpa_supplicant would be never interactive with this kind of packets,
if SUPPORTS_RX_DECAP_OFFLOAD is enabled. This causes STA always rekey fail
if EAPoL frame go through 802.3 path.

To avoid this problem, align the same process as 802.11 type to handle
this frame before put it into network stack.

This also addresses a potential security issue in 802.3 RX mode that was
previously fixed in commit a8c4d76a ("mac80211: do not accept/forward
invalid EAPOL frames").

Cc: stable@vger.kernel.org # 5.12+
Fixes: 80a915ec ("mac80211: add rx decapsulation offload support")
Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
Link: https://lore.kernel.org/r/6889c9fced5859ebb088564035f84fd0fa792a49.1644680751.git.deren.wu@mediatek.com
[fix typos, update comment and add note about security issue]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent bf8e59fd
...@@ -2607,7 +2607,8 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb, ...@@ -2607,7 +2607,8 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,
* address, so that the authenticator (e.g. hostapd) will see * address, so that the authenticator (e.g. hostapd) will see
* the frame, but bridge won't forward it anywhere else. Note * the frame, but bridge won't forward it anywhere else. Note
* that due to earlier filtering, the only other address can * that due to earlier filtering, the only other address can
* be the PAE group address. * be the PAE group address, unless the hardware allowed them
* through in 802.3 offloaded mode.
*/ */
if (unlikely(skb->protocol == sdata->control_port_protocol && if (unlikely(skb->protocol == sdata->control_port_protocol &&
!ether_addr_equal(ehdr->h_dest, sdata->vif.addr))) !ether_addr_equal(ehdr->h_dest, sdata->vif.addr)))
...@@ -4514,12 +4515,7 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx, ...@@ -4514,12 +4515,7 @@ static void ieee80211_rx_8023(struct ieee80211_rx_data *rx,
/* deliver to local stack */ /* deliver to local stack */
skb->protocol = eth_type_trans(skb, fast_rx->dev); skb->protocol = eth_type_trans(skb, fast_rx->dev);
memset(skb->cb, 0, sizeof(skb->cb)); ieee80211_deliver_skb_to_local_stack(skb, rx);
if (rx->list)
list_add_tail(&skb->list, rx->list);
else
netif_receive_skb(skb);
} }
static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx,
......
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