netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 1/2] xfrm6: Fix IPv6 payload_len in xfrm6_transport_finish
@ 2017-06-22  8:37 yossiku
  2017-06-22  8:37 ` [PATCH net v2 2/2] esp6_offload: Fix IP6CB(skb)->nhoff for ESP GRO yossiku
  0 siblings, 1 reply; 3+ messages in thread
From: yossiku @ 2017-06-22  8:37 UTC (permalink / raw)
  To: netdev, Herbert Xu, Steffen Klassert
  Cc: Yevgeny Kliteynik, Boris Pismenny, Ilan Tayari, Yossi Kuperman

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: 7785bba299a8 ("esp: Add a software GRO codepath")
Signed-off-by: Yossi Kuperman <yossiku@mellanox.com>
---
v1 -> v2:
	- Fix the "Fixes" tag
---
 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));
 
 	if (xo && (xo->flags & XFRM_GRO)) {
 		skb_mac_header_rebuild(skb);
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-22 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-22  8:37 [PATCH net v2 1/2] xfrm6: Fix IPv6 payload_len in xfrm6_transport_finish yossiku
2017-06-22  8:37 ` [PATCH net v2 2/2] esp6_offload: Fix IP6CB(skb)->nhoff for ESP GRO yossiku
2017-06-22 10:52   ` Steffen Klassert

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).