diff mbox series

[4.4] mac80211: fix memory corruption in EAPOL handling

Message ID 20210710183710.5687-1-davis@mosenkovs.lv
State Superseded
Headers show
Series [4.4] mac80211: fix memory corruption in EAPOL handling | expand

Commit Message

Davis July 10, 2021, 6:37 p.m. UTC
Commit e3d4030498c3 ("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: e3d4030498c3 ("mac80211: do not accept/forward invalid EAPOL frames")
Link: https://lore.kernel.org/r/CAHQn7pKcyC_jYmGyTcPCdk9xxATwW5QPNph=bsZV8d-HPwNsyA@mail.gmail.com
Cc: <stable@vger.kernel.org> # 4.4.x
Signed-off-by: Davis Mosenkovs <davis@mosenkovs.lv>
---
 net/mac80211/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg KH July 15, 2021, 11:55 a.m. UTC | #1
On Sat, Jul 10, 2021 at 09:37:10PM +0300, Davis Mosenkovs wrote:
> Commit e3d4030498c3 ("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.

So this is also needed in 4.9 and 4.14, right?  If so, now queued up
everywhere.  If not, please let me know so I can drop it from the other
trees.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bde924968cd2..b5848bcc09eb 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2234,7 +2234,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);