mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: chcr - Balance inflight count on invalid RFC4106 AAD length
@ 2026-11-03  7:52 Wentao Liang
  2026-11-03  9:28 ` Krzysztof Kozlowski
  2026-11-13 13:06 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-11-03  7:52 UTC (permalink / raw)
  To: ayush.sawal, herbert
  Cc: davem, linux-crypto, linux-kernel, Wentao Liang, stable

chcr_aead_op() increments the device inflight counter before checking
the RFC4106 associated data length. If the length is invalid, it returns
-EINVAL without submitting a request or decrementing the counter. No
completion can balance that increment, so device teardown keeps seeing
an outstanding request.

Decrement the counter before returning from this validation failure,
matching the other synchronous error exits after chcr_inc_wrcount().

Fixes: d91a3159e8d9 ("Crypto/chcr: fix gcm-aes and rfc4106-gcm failed tests")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/crypto/chelsio/chcr_algo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index fd4720fa50a9..ac4e40d5292c 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -3651,6 +3651,7 @@ static int chcr_aead_op(struct aead_request *req,
 	    crypto_ipsec_check_assoclen(req->assoclen) != 0) {
 		pr_err("RFC4106: Invalid value of assoclen %d\n",
 		       req->assoclen);
+		chcr_dec_wrcount(cdev);
 		return -EINVAL;
 	}
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-13 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03  7:52 [PATCH] crypto: chcr - Balance inflight count on invalid RFC4106 AAD length Wentao Liang
2026-11-03  9:28 ` Krzysztof Kozlowski
2026-11-13 13:06 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®