Re: [PATCH v2] hwrng: core - Do not read data during PM sleep transition
From: Herbert Xu
Date: Thu Jun 11 2026 - 01:33:37 EST
On Mon, Jun 01, 2026 at 03:19:13PM +0200, Thomas Richard (TI) wrote:
>
> @@ -538,8 +539,9 @@ static int hwrng_fillfn(void *unused)
> }
>
> mutex_lock(&reading_mutex);
> - rc = rng_get_data(rng, rng_fillbuf,
> - rng_buffer_size(), 1);
> + if (!pm_sleep_transition_in_progress())
> + rc = rng_get_data(rng, rng_fillbuf,
> + rng_buffer_size(), 1);
Sashiko asks how this can be safe given that there is no locking
at all. That's exactly what I was going to ask :)
Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt