aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ah6.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/ah6.c')
-rw-r--r--net/ipv6/ah6.c9
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) {