xfrm: Reset encapsulation field of the skb before transformation
authorSteffen Klassert <steffen.klassert@secunet.com>
Mon, 22 Feb 2016 09:56:45 +0000 (10:56 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Thu, 17 Mar 2016 09:28:44 +0000 (10:28 +0100)
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>
net/xfrm/xfrm_output.c

index ff4a91fcab9fd291b09eb48487690301c4388ae2..637387bbaaea33f62a1a970c9a361c895c4e5f2d 100644 (file)
@@ -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;