linux/drivers/char/tpm/st33zp24
Ruoyu Wang 264216889d tpm: st33zp24: Validate locality read result
check_locality() treats every nonzero transport return as success. SPI
errors remain negative, while the I2C path can convert a negative write
error through its byte-sized status variable. Either result is nonzero
even though the TPM_ACCESS byte can remain unwritten, so indeterminate
ACTIVE_LOCALITY and VALID bits can falsely report an active locality.

Require recv() to return exactly the requested byte before examining
TPM_ACCESS. Transport errors and short reads now report an inactive
locality, while successful reads retain the existing behavior.

This issue was found by a static analysis checker and confirmed by manual
source review.

Fixes: 251a7b0821 ("TPM: STMicroelectronics ST33 I2C KERNEL 3.x")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Link: https://lore.kernel.org/r/20260813153032.3951878-2-ruoyuw560@gmail.com
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-08-25 18:13:34 +03:00
..
i2c.c tpm: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-09-17 18:56:37 +03:00
Kconfig
Makefile
spi.c Normalise "name (ad@dr)" MODULE_AUTHORs to "name <ad@dr>" 2024-03-06 13:07:39 -08:00
st33zp24.c tpm: st33zp24: Validate locality read result 2026-08-25 18:13:34 +03:00
st33zp24.h tpm: st33zp24: switch to using gpiod API 2022-12-08 16:20:46 +00:00