diff mbox series

[SRU,Bionic,1/1] mac80211: fix memory corruption in EAPOL handling

Message ID 20210728143638.150591-2-stefan.bader@canonical.com
State New
Headers show
Series Fix regression on laptops with 4.15.0-149..151 | expand

Commit Message

Stefan Bader July 28, 2021, 2:36 p.m. UTC
From: Davis Mosenkovs <davis@mosenkovs.lv>

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

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 3b6d3d1884fa31f701603772732c404020b0598d linux.4.14.y)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Tested-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 net/mac80211/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tim Gardner July 28, 2021, 2:56 p.m. UTC | #1
Acked-by: Tim Gardner <tim.gardner@canonical.com>

On 7/28/21 8:36 AM, Stefan Bader wrote:
> forward invalid EAPOL
Juerg Haefliger July 28, 2021, 3:13 p.m. UTC | #2
On Wed, 28 Jul 2021 16:36:38 +0200
Stefan Bader <stefan.bader@canonical.com> wrote:

> From: Davis Mosenkovs <davis@mosenkovs.lv>
> 
> BugLink: https://bugs.launchpad.net/bugs/1938013
> 
> 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>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> (cherry picked from commit 3b6d3d1884fa31f701603772732c404020b0598d linux.4.14.y)

Nit: Should be linux-4.14.y.


> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> Tested-by: Juerg Haefliger <juerg.haefliger@canonical.com>

Acked-by: Juerg Haefliger <juergh@canonical.com>


> ---
>  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 95e6d41626d6..7847b168c9ce 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -2407,7 +2407,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);
Tim Gardner July 28, 2021, 3:18 p.m. UTC | #3
Shouldn't this also go upstream ? It looks like 4.14.y is still supported.

On 7/28/21 8:56 AM, Tim Gardner wrote:
> Acked-by: Tim Gardner <tim.gardner@canonical.com>
> 
> On 7/28/21 8:36 AM, Stefan Bader wrote:
>> forward invalid EAPOL
>
Tim Gardner July 28, 2021, 3:19 p.m. UTC | #4
Nevermind, its in v4.14.240

On 7/28/21 9:18 AM, Tim Gardner wrote:
> Shouldn't this also go upstream ? It looks like 4.14.y is still supported.
> 
> On 7/28/21 8:56 AM, Tim Gardner wrote:
>> Acked-by: Tim Gardner <tim.gardner@canonical.com>
>>
>> On 7/28/21 8:36 AM, Stefan Bader wrote:
>>> forward invalid EAPOL
>>
>
diff mbox series

Patch

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 95e6d41626d6..7847b168c9ce 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2407,7 +2407,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);