[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aYXJsgvEp9FtCnl1@gondor.apana.org.au>
Date: Fri, 6 Feb 2026 19:00:02 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Zilin Guan <zilin@....edu.cn>
Cc: jiajie.ho@...rfivetech.com, william.qiu@...rfivetech.com,
davem@...emloft.net, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: starfive - Fix memory leak in
starfive_aes_aead_do_one_req()
On Thu, Jan 29, 2026 at 03:10:16PM +0000, Zilin Guan wrote:
> The starfive_aes_aead_do_one_req() function allocates rctx->adata with
> kzalloc() but fails to free it if sg_copy_to_buffer() or
> starfive_aes_hw_init() fails, which lead to memory leaks.
>
> Since rctx->adata is unconditionally freed after the write_adata
> operations, ensure consistent cleanup by freeing the allocation in these
> earlier error paths as well.
>
> Compile tested only. Issue found using a prototype static analysis tool
> and code review.
>
> Fixes: 7467147ef9bf ("crypto: starfive - Use dma for aes requests")
> Signed-off-by: Zilin Guan <zilin@....edu.cn>
> ---
> drivers/crypto/starfive/jh7110-aes.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists