From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Mon, 22 Feb 2016 09:56:45 +0000 (+0100)
Subject: xfrm: Reset encapsulation field of the skb before transformation
X-Git-Tag: v4.6~31^2~20^2~1
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=215276c0147ef49bc07692ca68bae35a30a64b9a;p=linux.git

xfrm: Reset encapsulation field of the skb before transformation

The inner headers are invalid after a xfrm transformation.
So reset the skb encapsulation field to ensure nobody tries
to access the inner headers.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---

diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index ff4a91fcab9f..637387bbaaea 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -99,6 +99,9 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
 
 		skb_dst_force(skb);
 
+		/* Inner headers are invalid now. */
+		skb->encapsulation = 0;
+
 		err = x->type->output(x, skb);
 		if (err == -EINPROGRESS)
 			goto out;