On Mon, Apr 03, 2006 at 11:33:16PM +0200, Christophe Saout wrote:
> 
> I'm getting a crash in xfrm4_rcv_encap few seconds after setting up my
> IPSEC connection (tunnel for default route 0.0.0.0/0 to next router).

Sorry about that.  This patch should fix the problem.

[IPSEC]: Check x->encap before dereferencing it

We need to dereference x->encap before dereferencing it for encap_type.
If it's absent then the encap_type is zero.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index e1b8f4b..7a0b952 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -90,7 +90,7 @@
                if (unlikely(x->km.state != XFRM_STATE_VALID))
                        goto drop_unlock;
 
-               if (x->encap->encap_type != encap_type)
+               if ((x->encap ? x->encap->encap_type : 0) != encap_type)
                        goto drop_unlock;
 
                if (x->props.replay_window && xfrm_replay_check(x, seq))
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c

Reply via email to