diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-10-09 13:33:35 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 16:55:03 -0700 |
commit | b7c6538cd84f8072fad43bfce530f5bf695edbba (patch) | |
tree | e0ba79ffe7b79355985a45de9961b17a0462764f /net/ipv4/ah4.c | |
parent | 050f009e16f908932070313c1745d09dc69fd62b (diff) | |
download | op-kernel-dev-b7c6538cd84f8072fad43bfce530f5bf695edbba.zip op-kernel-dev-b7c6538cd84f8072fad43bfce530f5bf695edbba.tar.gz |
[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/ipv4/ah4.c')
-rw-r--r-- | net/ipv4/ah4.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 58af298..3513149 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c @@ -5,6 +5,7 @@ #include <net/ah.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> +#include <linux/spinlock.h> #include <net/icmp.h> #include <net/protocol.h> #include <asm/scatterlist.h> @@ -97,10 +98,14 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb) ah->reserved = 0; ah->spi = x->id.spi; ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq); + + spin_lock_bh(&x->lock); err = ah_mac_digest(ahp, skb, ah->auth_data); + memcpy(ah->auth_data, ahp->work_icv, ahp->icv_trunc_len); + spin_unlock_bh(&x->lock); + if (err) goto error; - memcpy(ah->auth_data, ahp->work_icv, ahp->icv_trunc_len); top_iph->tos = iph->tos; top_iph->ttl = iph->ttl; |