aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/mip6.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-11-14 00:45:58 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:53:52 -0500
commit0ebea8ef3559b545c37b016f44e84c3b33e47c39 (patch)
tree7a47787c1b830084ac2d36371490b9e2574e2472 /net/ipv6/mip6.c
parent668dc8af3150f837f7f0461001bbbc0ce25d7bdf (diff)
[IPSEC]: Move state lock into x->type->input
This patch releases the lock on the state before calling x->type->input. It also adds the lock to the spots where they're currently needed. Most of those places (all except mip6) are expected to disappear with async crypto. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/mip6.c')
-rw-r--r--net/ipv6/mip6.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index edfd9cdd721c..49d396620eac 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -128,12 +128,15 @@ static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)
128{ 128{
129 struct ipv6hdr *iph = ipv6_hdr(skb); 129 struct ipv6hdr *iph = ipv6_hdr(skb);
130 struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data; 130 struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data;
131 int err = destopt->nexthdr;
131 132
133 spin_lock(&x->lock);
132 if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) && 134 if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) &&
133 !ipv6_addr_any((struct in6_addr *)x->coaddr)) 135 !ipv6_addr_any((struct in6_addr *)x->coaddr))
134 return -ENOENT; 136 err = -ENOENT;
137 spin_unlock(&x->lock);
135 138
136 return destopt->nexthdr; 139 return err;
137} 140}
138 141
139/* Destination Option Header is inserted. 142/* Destination Option Header is inserted.
@@ -344,12 +347,15 @@ static struct xfrm_type mip6_destopt_type =
344static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) 347static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb)
345{ 348{
346 struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data; 349 struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data;
350 int err = rt2->rt_hdr.nexthdr;
347 351
352 spin_lock(&x->lock);
348 if (!ipv6_addr_equal(&rt2->addr, (struct in6_addr *)x->coaddr) && 353 if (!ipv6_addr_equal(&rt2->addr, (struct in6_addr *)x->coaddr) &&
349 !ipv6_addr_any((struct in6_addr *)x->coaddr)) 354 !ipv6_addr_any((struct in6_addr *)x->coaddr))
350 return -ENOENT; 355 err = -ENOENT;
356 spin_unlock(&x->lock);
351 357
352 return rt2->rt_hdr.nexthdr; 358 return err;
353} 359}
354 360
355/* Routing Header type 2 is inserted. 361/* Routing Header type 2 is inserted.