Re: [PATCH v3] Fix multiple issues in chcr driver:
From: Herbert Xu
Date: Fri Jul 03 2026 - 05:31:10 EST
On Mon, Jun 22, 2026 at 11:19:10PM +0800, Wentao Liang wrote:
> 1. In chcr_ahash_final() and chcr_ahash_digest(), chcr_send_wr()
> return value is not checked. If it fails, DMA buffers are not
> unmapped, causing leaks.
>
> 2. In chcr_aead_op(), the inflight counter is not decremented when
> assoclen validation fails.
>
> Fix by:
> - Adding error handling for chcr_send_wr() with goto unmap
> - Adding chcr_dec_wrcount() on the assoclen error path
>
> Fix the following functions with missing decrement on error paths:
> - chcr_aes_encrypt()
> - chcr_aes_decrypt()
> - chcr_aead_op()
>
> For chcr_aes_encrypt() and chcr_aes_decrypt(), use a common error
> label to decrement the counter. For chcr_aead_op(), use the existing
> chcr_dec_wrcount() helper on the invalid assoclen error path.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: b8fd1f4170e7 ("crypto: chcr - Add ctr mode and process large sg entries for cipher")
> Fixes: d91a3159e8d9 ("Crypto/chcr: fix gcm-aes and rfc4106-gcm failed tests")
> Fixes: 324429d74127 ("chcr: Support for Chelsio's Crypto Hardware")
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---
> drivers/crypto/chelsio/chcr_algo.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
Please take a look at
https://sashiko.dev/#/patchset/20260622151910.49402-1-vulab%40iscas.ac.cn
Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt