[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240912060307.GA18251@breakpoint.cc>
Date: Thu, 12 Sep 2024 08:03:07 +0200
From: Florian Westphal <fw@...len.de>
To: En-Wei Wu <en-wei.wu@...onical.com>
Cc: steffen.klassert@...unet.com, herbert@...dor.apana.org.au,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kai.heng.feng@...onical.com,
chia-lin.kao@...onical.com, anthony.wong@...onical.com,
kuan-ying.lee@...onical.com, chris.chiu@...onical.com
Subject: Re: [PATCH ipsec] xfrm: avoid using skb->mac_len to decide if mac
header is shown
En-Wei Wu <en-wei.wu@...onical.com> wrote:
> When we use Intel WWAN with xfrm, our system always hangs after
> browsing websites for a few seconds. The error message shows that
> it is a slab-out-of-bounds error:
>
> The reason is that the eth_hdr(skb) inside the if statement evaluated
> to an unexpected address with skb->mac_header = ~0U (indicating there
> is no MAC header). The unreliability of skb->mac_len causes the if
> statement to become true even if there is no MAC header inside the
> skb data buffer.
>
> Replace the skb->mac_len in the if statement with the more reliable macro
> skb_mac_header_was_set(skb) fixes this issue.
>
> Fixes: b3284df1c86f ("xfrm: remove input2 indirection from xfrm_mode")
No, that just moved code around.
> Signed-off-by: En-Wei Wu <en-wei.wu@...onical.com>
> ---
> net/xfrm/xfrm_input.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
> index 749e7eea99e4..93b261340105 100644
> --- a/net/xfrm/xfrm_input.c
> +++ b/net/xfrm/xfrm_input.c
> @@ -251,7 +251,7 @@ static int xfrm4_remove_tunnel_encap(struct xfrm_state *x, struct sk_buff *skb)
>
> skb_reset_network_header(skb);
> skb_mac_header_rebuild(skb);
> - if (skb->mac_len)
> + if (skb_mac_header_was_set(skb))
> eth_hdr(skb)->h_proto = skb->protocol;
I think you will need to check both, else you restore the bug fixed in
87cdf3148b11 ("xfrm: Verify MAC header exists before overwriting
eth_hdr(skb)->h_proto").
Powered by blists - more mailing lists