[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQxpnckYMgAAOLpZ@gondor.apana.org.au>
Date: Thu, 6 Nov 2025 17:25:49 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Haotian Zhang <vulab@...as.ac.cn>
Cc: nhorman@...driver.com, davem@...emloft.net,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: ansi_cprng: fix cipher leak in cprng_init error
path
On Thu, Nov 06, 2025 at 04:48:50PM +0800, Haotian Zhang wrote:
> In the commit referenced by the Fixes tag, crypto_alloc_cipher()
> was moved from reset_prng_context() to cprng_init(). However,
> this approach does not account for the error path: when
> reset_prng_context() fails, crypto_free_cipher() is never called,
> resulting in a resource leak.
>
> Free the allocated cipher before returning on reset_prng_context()
> failure.
>
> Fixes: fd09d7facb7c ("crypto: ansi_prng - alloc cipher just in init")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
> crypto/ansi_cprng.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Please instead provide a patch to remove ansi_cprng. It's obsolete
and unused.
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