Re: [BUGFIX PATCH] crypto: ccree: fix resume race condition on init

From: Herbert Xu
Date: Fri Feb 08 2019 - 02:48:42 EST


On Thu, Feb 07, 2019 at 03:36:11PM +0200, Gilad Ben-Yossef wrote:
> We were enabling autosuspend, which is using data set by the
> hash module, prior to the hash module being inited, casuing
> a crash on resume as part of the startup sequence if the race
> was lost.
>
> This was never a real problem because the PM infra was using low
> res timers so we were always winning the race, until commit 8234f6734c5d
> ("PM-runtime: Switch autosuspend over to using hrtimers") changed that :-)
>
> Fix this by seperating the PM setup and enablement and doing the
> latter only at the end of the init sequence.
>
> Signed-off-by: Gilad Ben-Yossef <gilad@xxxxxxxxxxxxx>
> Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxx # v4.20
> ---
> Herbert, could you please take this for 5.0-rc6 ? thanks.
>
> drivers/crypto/ccree/cc_driver.c | 7 ++++---
> drivers/crypto/ccree/cc_pm.c | 13 ++++++-------
> drivers/crypto/ccree/cc_pm.h | 3 +++
> 3 files changed, 13 insertions(+), 10 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