Skip to content
Commit 9265fed6 authored by Jarkko Sakkinen's avatar Jarkko Sakkinen
Browse files

tpm: Lock TPM chip in tpm_pm_suspend() first



Setting TPM_CHIP_FLAG_SUSPENDED in the end of tpm_pm_suspend() can be racy
according, as this leaves window for tpm_hwrng_read() to be called while
the operation is in progress. The recent bug report gives also evidence of
this behaviour.

Aadress this by locking the TPM chip before checking any chip->flags both
in tpm_pm_suspend() and tpm_hwrng_read(). Move TPM_CHIP_FLAG_SUSPENDED
check inside tpm_get_random() so that it will be always checked only when
the lock is reserved.

Cc: stable@vger.kernel.org # v6.4+
Fixes: 99d46450 ("tpm: Prevent hwrng from activating during resume")
Reported-by: default avatarMike Seo <mikeseohyungjin@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219383


Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Tested-by: default avatarMike Seo <mikeseohyungjin@gmail.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
parent 11066801
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment