]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
esp: Fix misplaced spin_unlock_bh.
authorSteffen Klassert <steffen.klassert@secunet.com>
Mon, 24 Apr 2017 05:33:56 +0000 (07:33 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 24 Apr 2017 05:56:31 +0000 (07:56 +0200)
A recent commit moved esp_alloc_tmp() out of a lock
protected region, but forgot to remove the unlock from
the error path. This patch removes the forgotten unlock.
While at it, remove some unneeded error assignments too.

Fixes: fca11ebde3f0 ("esp4: Reorganize esp_output")
Fixes: 383d0350f2cc ("esp6: Reorganize esp_output")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv4/esp4.c
net/ipv6/esp6.c

index 7e501adb50421f625c0816332efcce0df18123cd..7f2caf71212beb1b3a65cdf75df38868be21c627 100644 (file)
@@ -356,11 +356,8 @@ int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
        ivlen = crypto_aead_ivsize(aead);
 
        tmp = esp_alloc_tmp(aead, esp->nfrags + 2, extralen);
-       if (!tmp) {
-               spin_unlock_bh(&x->lock);
-               err = -ENOMEM;
+       if (!tmp)
                goto error;
-       }
 
        extra = esp_tmp_extra(tmp);
        iv = esp_tmp_iv(aead, tmp, extralen);
@@ -389,7 +386,6 @@ int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
                spin_lock_bh(&x->lock);
                if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {
                        spin_unlock_bh(&x->lock);
-                       err = -ENOMEM;
                        goto error;
                }
 
index 8b55abf1c45bdf10b2db286f48c744ded7ab07c2..1fe99ba8066c8de2a5717f0b611a152c94837734 100644 (file)
@@ -330,11 +330,8 @@ int esp6_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info
        ivlen = crypto_aead_ivsize(aead);
 
        tmp = esp_alloc_tmp(aead, esp->nfrags + 2, seqhilen);
-       if (!tmp) {
-               spin_unlock_bh(&x->lock);
-               err = -ENOMEM;
+       if (!tmp)
                goto error;
-       }
 
        seqhi = esp_tmp_seqhi(tmp);
        iv = esp_tmp_iv(aead, tmp, seqhilen);
@@ -362,7 +359,6 @@ int esp6_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info
                spin_lock_bh(&x->lock);
                if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {
                        spin_unlock_bh(&x->lock);
-                       err = -ENOMEM;
                        goto error;
                }