Skip to content

Commit e892d2d

Browse files
committed
esp: Fix misplaced spin_unlock_bh.
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: fca11eb ("esp4: Reorganize esp_output") Fixes: 383d035 ("esp6: Reorganize esp_output") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent e2989ee commit e892d2d

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

net/ipv4/esp4.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,8 @@ int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
356356
ivlen = crypto_aead_ivsize(aead);
357357

358358
tmp = esp_alloc_tmp(aead, esp->nfrags + 2, extralen);
359-
if (!tmp) {
360-
spin_unlock_bh(&x->lock);
361-
err = -ENOMEM;
359+
if (!tmp)
362360
goto error;
363-
}
364361

365362
extra = esp_tmp_extra(tmp);
366363
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 *
389386
spin_lock_bh(&x->lock);
390387
if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {
391388
spin_unlock_bh(&x->lock);
392-
err = -ENOMEM;
393389
goto error;
394390
}
395391

net/ipv6/esp6.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,8 @@ int esp6_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info
330330
ivlen = crypto_aead_ivsize(aead);
331331

332332
tmp = esp_alloc_tmp(aead, esp->nfrags + 2, seqhilen);
333-
if (!tmp) {
334-
spin_unlock_bh(&x->lock);
335-
err = -ENOMEM;
333+
if (!tmp)
336334
goto error;
337-
}
338335

339336
seqhi = esp_tmp_seqhi(tmp);
340337
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
362359
spin_lock_bh(&x->lock);
363360
if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {
364361
spin_unlock_bh(&x->lock);
365-
err = -ENOMEM;
366362
goto error;
367363
}
368364

0 commit comments

Comments
 (0)