netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: <yossiku@mellanox.com>
Cc: <netdev@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Yevgeny Kliteynik <kliteyn@mellanox.com>,
	Boris Pismenny <borisp@mellanox.com>,
	Ilan Tayari <ilant@mellanox.com>
Subject: Re: [PATCH net 1/2] xfrm6: Fix IPv6 payload_len in xfrm6_transport_finish
Date: Wed, 21 Jun 2017 07:37:26 +0200	[thread overview]
Message-ID: <20170621053725.GP2631@secunet.com> (raw)
In-Reply-To: <1497861201-30262-1-git-send-email-yossiku@mellanox.com>

On Mon, Jun 19, 2017 at 11:33:20AM +0300, yossiku@mellanox.com wrote:
> From: Yossi Kuperman <yossiku@mellanox.com>
> 
> IPv6 payload length indicates the size of the payload, including any
> extension headers. In xfrm6_transport_finish, ipv6_hdr(skb)->payload_len
> is set to the payload size only, regardless of the presence of any
> extension headers.
> 
> After ESP GRO transport mode decapsulation, ipv6_rcv trims the packet
> according to the wrong payload_len, thus corrupting the packet.
> 
> Set payload_len to account for extension headers as well.
> 
> Fixes: 716062fd4c2f ("[IPSEC]: Merge most of the input path")
> Signed-off-by: Yossi Kuperman <yossiku@mellanox.com>
> ---
>  net/ipv6/xfrm6_input.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
> index 08a807b..3ef5d91 100644
> --- a/net/ipv6/xfrm6_input.c
> +++ b/net/ipv6/xfrm6_input.c
> @@ -43,8 +43,8 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async)
>  		return 1;
>  #endif
>  
> -	ipv6_hdr(skb)->payload_len = htons(skb->len);
>  	__skb_push(skb, skb->data - skb_network_header(skb));
> +	ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));

You mentioned that the bug happens with ESP GRO. Does this bug also
happen in the standard codepath? If not, you might better move the
above line into the 'if' section below.

>  
>  	if (xo && (xo->flags & XFRM_GRO)) {
>  		skb_mac_header_rebuild(skb);
> -- 
> 2.8.1

  parent reply	other threads:[~2017-06-21  5:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19  8:33 [PATCH net 1/2] xfrm6: Fix IPv6 payload_len in xfrm6_transport_finish yossiku
2017-06-19  8:33 ` [PATCH net 2/2] esp6_offload: Fix IP6CB(skb)->nhoff for ESP GRO yossiku
2017-06-21  5:37 ` Steffen Klassert [this message]
2017-06-21 11:24   ` [PATCH net 1/2] xfrm6: Fix IPv6 payload_len in xfrm6_transport_finish Yossi Kuperman
2017-06-21 11:38     ` Steffen Klassert
2017-06-21 15:59       ` Yossi Kuperman
2017-06-21 20:38       ` Yossi Kuperman
2017-06-22  7:15         ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170621053725.GP2631@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=borisp@mellanox.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ilant@mellanox.com \
    --cc=kliteyn@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=yossiku@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).