public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4.11 -stable] Networking
@ 2017-07-03 15:11 David Miller
  2017-07-03 15:55 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: David Miller @ 2017-07-03 15:11 UTC (permalink / raw)
  To: stable; +Cc: steffen.klassert

[-- Attachment #1: Type: Text/Plain, Size: 68 bytes --]


Please queue up the following patch for v4.11 -stable.

Thank you.

[-- Attachment #2: 0001-esp4-Fix-udpencap-for-local-TCP-packets.patch --]
[-- Type: Text/X-Patch, Size: 1748 bytes --]

>From 20218ba11828773f48fad8fcf23d9ba7b6cfb711 Mon Sep 17 00:00:00 2001
From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Fri, 9 Jun 2017 11:35:46 +0200
Subject: [PATCH] esp4: Fix udpencap for local TCP packets.

[ Upstream commit 0e78a87306a6f55b1c7bbafad1de62c3975953ca ]

Locally generated TCP packets are usually cloned, so we
do skb_cow_data() on this packets. After that we need to
reload the pointer to the esp header. On udpencap this
header has an offset to skb_transport_header, so take this
offset into account.

This is a backport of:
commit 0e78a87306a ("esp4: Fix udpencap for local TCP packets.")

Fixes: 67d349ed603 ("net/esp4: Fix invalid esph pointer crash")
Fixes: fca11ebde3f0 ("esp4: Reorganize esp_output")
Reported-by: Don Bowman <db@donbowman.ca>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/esp4.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index b1e2444..9708a32 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -212,6 +212,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
 	u8 *iv;
 	u8 *tail;
 	u8 *vaddr;
+	int esph_offset;
 	int blksize;
 	int clen;
 	int alen;
@@ -392,12 +393,14 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
 	}
 
 cow:
+	esph_offset = (unsigned char *)esph - skb_transport_header(skb);
+
 	err = skb_cow_data(skb, tailen, &trailer);
 	if (err < 0)
 		goto error;
 	nfrags = err;
 	tail = skb_tail_pointer(trailer);
-	esph = ip_esp_hdr(skb);
+	esph = (struct ip_esp_hdr *)(skb_transport_header(skb) + esph_offset);
 
 skip_cow:
 	esp_output_fill_trailer(tail, tfclen, plen, proto);
-- 
2.9.4


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

end of thread, other threads:[~2017-07-03 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03 15:11 [PATCH v4.11 -stable] Networking David Miller
2017-07-03 15:55 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox