diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-10-09 16:33:35 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:03 -0400 |
commit | b7c6538cd84f8072fad43bfce530f5bf695edbba (patch) | |
tree | e0ba79ffe7b79355985a45de9961b17a0462764f /net/ipv6/ah6.c | |
parent | 050f009e16f908932070313c1745d09dc69fd62b (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/ah6.c')
-rw-r--r-- | net/ipv6/ah6.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index ff904a711f3a..c51d77564b44 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <net/ah.h> | 29 | #include <net/ah.h> |
30 | #include <linux/crypto.h> | 30 | #include <linux/crypto.h> |
31 | #include <linux/pfkeyv2.h> | 31 | #include <linux/pfkeyv2.h> |
32 | #include <linux/spinlock.h> | ||
32 | #include <linux/string.h> | 33 | #include <linux/string.h> |
33 | #include <net/icmp.h> | 34 | #include <net/icmp.h> |
34 | #include <net/ipv6.h> | 35 | #include <net/ipv6.h> |
@@ -284,12 +285,14 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
284 | ah->reserved = 0; | 285 | ah->reserved = 0; |
285 | ah->spi = x->id.spi; | 286 | ah->spi = x->id.spi; |
286 | ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq); | 287 | ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq); |
288 | |||
289 | spin_lock_bh(&x->lock); | ||
287 | err = ah_mac_digest(ahp, skb, ah->auth_data); | 290 | err = ah_mac_digest(ahp, skb, ah->auth_data); |
288 | if (err) | ||
289 | goto error_free_iph; | ||
290 | memcpy(ah->auth_data, ahp->work_icv, ahp->icv_trunc_len); | 291 | memcpy(ah->auth_data, ahp->work_icv, ahp->icv_trunc_len); |
292 | spin_unlock_bh(&x->lock); | ||
291 | 293 | ||
292 | err = 0; | 294 | if (err) |
295 | goto error_free_iph; | ||
293 | 296 | ||
294 | memcpy(top_iph, tmp_base, sizeof(tmp_base)); | 297 | memcpy(top_iph, tmp_base, sizeof(tmp_base)); |
295 | if (tmp_ext) { | 298 | if (tmp_ext) { |