tpm: Prevent hwrng from activating during resume
authorJarkko Sakkinen <jarkko@kernel.org>
Wed, 26 Apr 2023 17:29:28 +0000 (20:29 +0300)
committerJarkko Sakkinen <jarkko@kernel.org>
Mon, 15 May 2023 23:43:12 +0000 (02:43 +0300)
commit99d46450625590d410f86fe4660a5eff7d3b8343
tree446c3d6a59c7a4a8762954ee3e527ff0b257d686
parent1398aa803f198b7a386fdd8404666043e95f4c16
tpm: Prevent hwrng from activating during resume

Set TPM_CHIP_FLAG_SUSPENDED in tpm_pm_suspend() and reset in
tpm_pm_resume(). While the flag is set, tpm_hwrng() gives back zero
bytes. This prevents hwrng from racing during resume.

Cc: stable@vger.kernel.org
Fixes: 6e592a065d51 ("tpm: Move Linux RNG connection to hwrng")
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm-chip.c
drivers/char/tpm/tpm-interface.c
include/linux/tpm.h