linux/drivers/char
Jarkko Sakkinen 9265fed6db 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: 99d4645062 ("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>
2024-11-04 01:59:08 +02:00
..
agp Char/Misc and other driver changes for 6.11-rc1 2024-07-19 15:55:08 -07:00
hw_random hwrng: mtk - Use devm_pm_runtime_enable 2024-09-06 14:50:45 +08:00
ipmi [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
mwave char/mwave: Adjust io port register size 2021-12-03 14:27:06 +01:00
tpm tpm: Lock TPM chip in tpm_pm_suspend() first 2024-11-04 01:59:08 +02:00
xilinx_hwicap char: xilinx_hwicap: Fix NULL vs IS_ERR() bug 2024-03-07 21:48:38 +00:00
xillybus char: xillybus: Check USB endpoints when probing device 2024-08-16 09:57:56 +02:00
adi.c vfs-6.12.file 2024-09-16 09:14:02 +02:00
apm-emulation.c apm-emulation: drop unexpected word "the" in the comments 2022-06-27 16:15:27 +02:00
applicom.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
applicom.h
bsr.c bsr: add missing MODULE_DESCRIPTION() macro 2024-07-03 16:40:53 +02:00
ds1620.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
dsp56k.c dsp56k: add missing MODULE_DESCRIPTION() macro 2024-07-03 16:40:26 +02:00
dtlk.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
hangcheck-timer.c
hpet.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
Kconfig arch: Remove Itanium (IA-64) architecture 2023-09-11 08:13:17 +00:00
lp.c parport: Remove parport_driver.devmodel 2024-07-03 16:44:22 +02:00
Makefile arch: Remove Itanium (IA-64) architecture 2023-09-11 08:13:17 +00:00
mem.c fs: move FMODE_UNSIGNED_OFFSET to fop_flags 2024-08-30 08:22:36 +02:00
misc.c char: misc: make misc_class a static const structure 2023-06-23 10:27:15 +02:00
nsc_gpio.c
nvram.c char: add missing MODULE_DESCRIPTION() macros 2024-06-04 17:40:17 +02:00
nwbutton.c char: add missing NetWinder MODULE_DESCRIPTION() macros 2024-07-31 13:47:45 +02:00
nwbutton.h
nwflash.c char: add missing NetWinder MODULE_DESCRIPTION() macros 2024-07-31 13:47:45 +02:00
pc8736x_gpio.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
powernv-op-panel.c powerpc/powernv: Convert to platform remove callback returning void 2024-04-11 15:26:59 +02:00
ppdev.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
ps3flash.c
random.c random: vDSO: add __arch_get_k_vdso_rng_data() helper for data page access 2024-09-13 17:28:35 +02:00
scx200_gpio.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
sonypi.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
tlclk.c tlclk: add missing MODULE_DESCRIPTION() macro 2024-06-04 17:40:14 +02:00
toshiba.c module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
ttyprintk.c char: add missing MODULE_DESCRIPTION() macros 2024-06-04 17:40:17 +02:00
uv_mmtimer.c
virtio_console.c virtio: bugfixes 2024-10-07 11:33:26 -07:00