]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: Prevent hwrng from activating during resume
authorJarkko Sakkinen <jarkko@kernel.org>
Wed, 26 Apr 2023 17:29:28 +0000 (20:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 May 2023 13:03:16 +0000 (14:03 +0100)
commit3790348969c02f43ca996773f526f31da0860561
treec453feb0fe67e32e194e6291d6f029751df5a2c8
parent5f5035f44b29af77ba2b5a7de0b4576206be68c4
tpm: Prevent hwrng from activating during resume

[ Upstream commit 99d46450625590d410f86fe4660a5eff7d3b8343 ]

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: 07644cfa0011 ("tpm: Move Linux RNG connection to hwrng")
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/tpm/tpm-chip.c
drivers/char/tpm/tpm-interface.c
include/linux/tpm.h