# \[PATCH 4.9\] mac80211: fix memory corruption in EAPOL handling

- Subsystems: MAC80211, THE REST
- Maintainers: Johannes Berg, Linus Torvalds
- List: linux-wireless
- 1 message, 1 author
- Page: https://ratatoskr.run/linux-wireless/2021/07/6880945/t

## \[PATCH 4.9\] mac80211: fix memory corruption in EAPOL handling

- From: Davis Mosenkovs \<hidden\>
- Date: 2021-07-10 18:37:56 
- Message: https://ratatoskr.run/linux-wireless/2021/07/6880945.md

```text
Commit 5551cb1c68d4 ("mac80211: do not accept/forward invalid EAPOL
frames") uses skb_mac_header() before eth_type_trans() is called
leading to incorrect pointer, the pointer gets written to. This issue
has appeared during backporting to 4.4, 4.9 and 4.14.

Fixes: 5551cb1c68d4 ("mac80211: do not accept/forward invalid EAPOL frames")
Link: https://lore.kernel.org/r/CAHQn7pKcyC_jYmGyTcPCdk9xxATwW5QPNph=bsZV8d-HPwNsyA@mail.gmail.com
Cc: <redacted> # 4.9.x
Signed-off-by: Davis Mosenkovs <redacted>
---
 net/mac80211/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 3a069cb188b7..b40e71a5d795 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2380,7 +2380,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 #endif
 
 	if (skb) {
-		struct ethhdr *ehdr = (void *)skb_mac_header(skb);
+		struct ethhdr *ehdr = (struct ethhdr *)skb->data;
 
 		/* deliver to local stack */
 		skb->protocol = eth_type_trans(skb, dev);
-- 
2.25.1

```
