aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/mip6.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-10-09 16:33:35 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:03 -0400
commitb7c6538cd84f8072fad43bfce530f5bf695edbba (patch)
treee0ba79ffe7b79355985a45de9961b17a0462764f /net/ipv6/mip6.c
parent050f009e16f908932070313c1745d09dc69fd62b (diff)
[IPSEC]: Move state lock into x->type->output
This patch releases the lock on the state before calling x->type->output. 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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 7261c29898cb..6475baca63d2 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -172,7 +172,9 @@ static int mip6_destopt_output(struct xfrm_state *x, struct sk_buff *skb)
172 len = ((char *)hao - (char *)dstopt) + sizeof(*hao); 172 len = ((char *)hao - (char *)dstopt) + sizeof(*hao);
173 173
174 memcpy(&hao->addr, &iph->saddr, sizeof(hao->addr)); 174 memcpy(&hao->addr, &iph->saddr, sizeof(hao->addr));
175 spin_lock_bh(&x->lock);
175 memcpy(&iph->saddr, x->coaddr, sizeof(iph->saddr)); 176 memcpy(&iph->saddr, x->coaddr, sizeof(iph->saddr));
177 spin_unlock_bh(&x->lock);
176 178
177 BUG_TRAP(len == x->props.header_len); 179 BUG_TRAP(len == x->props.header_len);
178 dstopt->hdrlen = (x->props.header_len >> 3) - 1; 180 dstopt->hdrlen = (x->props.header_len >> 3) - 1;
@@ -381,7 +383,9 @@ static int mip6_rthdr_output(struct xfrm_state *x, struct sk_buff *skb)
381 BUG_TRAP(rt2->rt_hdr.hdrlen == 2); 383 BUG_TRAP(rt2->rt_hdr.hdrlen == 2);
382 384
383 memcpy(&rt2->addr, &iph->daddr, sizeof(rt2->addr)); 385 memcpy(&rt2->addr, &iph->daddr, sizeof(rt2->addr));
386 spin_lock_bh(&x->lock);
384 memcpy(&iph->daddr, x->coaddr, sizeof(iph->daddr)); 387 memcpy(&iph->daddr, x->coaddr, sizeof(iph->daddr));
388 spin_unlock_bh(&x->lock);
385 389
386 return 0; 390 return 0;
387} 391}