[PATCH] crypto: chelsio: fix inflight counter leak in chcr_aes_encrypt()

From: Wentao Liang

Date: Tue May 26 2026 - 12:05:44 EST


chcr_aes_encrypt() increments dev->inflight via atomic_inc() before
submitting the cipher operation. If chcr_start_cipher() subsequently
fails, the function returns an error without decrementing dev->inflight,
causing the counter to drift and potentially stalling future operations
that rely on the counter reaching zero.

Add atomic_dec(&dev->inflight) on the chcr_start_cipher() failure path
to restore the counter.

Fixes: b8fd1f4170e7 ("crypto: chcr - Add ctr mode and process large sg entries for cipher")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/crypto/chelsio/chcr_algo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 6dec42282768..eece1ac1085a 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -1359,7 +1359,7 @@ static int chcr_aes_encrypt(struct skcipher_request *req)
err = process_cipher(req, u_ctx->lldi.rxq_ids[reqctx->rxqidx],
&skb, CHCR_ENCRYPT_OP);
if (err || !skb)
- return err;
+ goto error;
skb->dev = u_ctx->lldi.ports[0];
set_wr_txq(skb, CPL_PRIORITY_DATA, reqctx->txqidx);
chcr_send_wr(skb);
--
2.34.1