Re: [PATCH] hwrng: cctrng - Fix runtime PM usage counter leak
From: Herbert Xu
Date: Fri Sep 04 2026 - 06:17:33 EST
On Fri, Aug 14, 2026 at 09:39:33PM +0800, Ruoyu Wang wrote:
> pm_runtime_get_sync() increments the device usage counter even when
> runtime resume fails. cctrng_read() propagates errors from
> cc_trng_pm_get() without scheduling the work that later drops the
> counter, so a clock or reset-completion failure in cctrng_resume()
> leaves the counter elevated.
>
> Use pm_runtime_resume_and_get(), which drops the usage counter when
> resume fails and returns zero on success. This preserves the existing
> success path while balancing the error path.
>
> This issue was found by a static analysis checker and confirmed by
> manual source review.
>
> Fixes: a583ed310bb6 ("hwrng: cctrng - introduce Arm CryptoCell driver")
> Signed-off-by: Ruoyu Wang <ruoyuw560@xxxxxxxxx>
> ---
> drivers/char/hw_random/cctrng.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt