]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[IPSEC]: Fix reversed ICMP6 policy check
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 13 Dec 2007 02:47:48 +0000 (18:47 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:57:41 +0000 (14:57 -0800)
The policy check I added for ICMP on IPv6 is reversed.  This
patch fixes that.

It also adds an skb->sp check so that unprotected packets that
fail the policy check do not crash the machine.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/icmp.c
net/ipv6/icmp.c

index 3c41a6f7e6ec7c62ae56e8b9844a460ce5430fcb..c41f3cc4fba83bc901f44b24b8e432ce2dba7880 100644 (file)
@@ -977,7 +977,7 @@ int icmp_rcv(struct sk_buff *skb)
        struct icmphdr *icmph;
        struct rtable *rt = (struct rtable *)skb->dst;
 
-       if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb) &&
+       if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb) && skb->sp &&
            skb->sp->xvec[skb->sp->len - 1]->props.flags & XFRM_STATE_ICMP) {
                int nh;
 
index c0bea7bfaa8a713ebc55c5663327e635a97a4b60..1659d2fb01fee445eaeae74470cf3c98c56b51b5 100644 (file)
@@ -644,7 +644,7 @@ static int icmpv6_rcv(struct sk_buff *skb)
        struct icmp6hdr *hdr;
        int type;
 
-       if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb) &&
+       if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb) && skb->sp &&
            skb->sp->xvec[skb->sp->len - 1]->props.flags & XFRM_STATE_ICMP) {
                int nh;