Browse Source

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>
Steffen Klassert 9 years ago
parent
commit
215276c014
1 changed files with 3 additions and 0 deletions
  1. 3 0
      net/xfrm/xfrm_output.c

+ 3 - 0
net/xfrm/xfrm_output.c

@@ -99,6 +99,9 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
 
 
 		skb_dst_force(skb);
 		skb_dst_force(skb);
 
 
+		/* Inner headers are invalid now. */
+		skb->encapsulation = 0;
+
 		err = x->type->output(x, skb);
 		err = x->type->output(x, skb);
 		if (err == -EINPROGRESS)
 		if (err == -EINPROGRESS)
 			goto out;
 			goto out;