diff options
author | Jarkko Sakkinen <jarkko@kernel.org> | 2024-10-31 03:16:09 +0300 |
---|---|---|
committer | Jarkko Sakkinen <jarkko@kernel.org> | 2024-11-04 02:59:08 +0300 |
commit | 9265fed6db601ee2ec47577815387458ef4f047a (patch) | |
tree | 80d52af37db72cf9eaf1ee80bb6aaa23580317e3 /tools/perf/scripts/python/mem-phys-addr.py | |
parent | 11066801dd4b7c4d75fce65c812723a80c1481ae (diff) | |
download | linux-9265fed6db601ee2ec47577815387458ef4f047a.tar.xz |
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: 99d464506255 ("tpm: Prevent hwrng from activating during resume")
Reported-by: Mike Seo <mikeseohyungjin@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219383
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Tested-by: Mike Seo <mikeseohyungjin@gmail.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/mem-phys-addr.py')
0 files changed, 0 insertions, 0 deletions