linux-stable/drivers/char/tpm
Alexander Steffen 03f60a67e7 tpm_tis: Explicitly check for error code
commit 513253f8c2 upstream.

recv_data either returns the number of received bytes, or a negative value
representing an error code. Adding the return value directly to the total
number of received bytes therefore looks a little weird, since it might add
a negative error code to a sum of bytes.

The following check for size < expected usually makes the function return
ETIME in that case, so it does not cause too many problems in practice. But
to make the code look cleaner and because the caller might still be
interested in the original error code, explicitly check for the presence of
an error code and pass that through.

Cc: stable@vger.kernel.org
Fixes: cb5354253a ("[PATCH] tpm: spacing cleanups 2")
Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-11 11:45:34 +02:00
..
eventlog tpm: vtpm_proxy: Avoid reading host log when using a virtual device 2021-05-22 10:59:20 +02:00
st33zp24 tpm: Fix some name collisions with drivers/char/tpm.h 2019-09-16 08:22:05 +02:00
Kconfig
Makefile
tpm-chip.c tpm: fix reference counting for struct tpm_chip 2022-04-15 14:14:37 +02:00
tpm-dev-common.c
tpm-dev.c
tpm-dev.h
tpm-interface.c
tpm-sysfs.c tpm: use tpm_try_get_ops() in tpm-sysfs.c. 2019-10-07 18:56:27 +02:00
tpm.h tpm: fix reference counting for struct tpm_chip 2022-04-15 14:14:37 +02:00
tpm2-cmd.c tpm: Fix buffer access in tpm2_get_tpm_pt() 2022-06-06 08:24:22 +02:00
tpm2-space.c tpm: fix reference counting for struct tpm_chip 2022-04-15 14:14:37 +02:00
tpm_atmel.c
tpm_atmel.h
tpm_crb.c tpm: tpm_crb: Add the missed acpi_put_table() to fix memory leak 2023-01-18 11:30:41 +01:00
tpm_i2c_atmel.c
tpm_i2c_infineon.c tpm: Fix some name collisions with drivers/char/tpm.h 2019-09-16 08:22:05 +02:00
tpm_i2c_nuvoton.c tpm: Fix some name collisions with drivers/char/tpm.h 2019-09-16 08:22:05 +02:00
tpm_ibmvtpm.c tpm: ibmvtpm: Correct the return value in tpm_ibmvtpm_probe() 2022-06-06 08:24:22 +02:00
tpm_ibmvtpm.h tpm: ibmvtpm: Wait for buffer to be set before proceeding 2020-10-01 13:14:37 +02:00
tpm_infineon.c
tpm_nsc.c
tpm_ppi.c
tpm_tis.c tpm/tpm_tis: Disable interrupts for more Lenovo devices 2023-05-30 12:42:11 +01:00
tpm_tis_core.c tpm_tis: Explicitly check for error code 2023-08-11 11:45:34 +02:00
tpm_tis_core.h
tpm_tis_spi.c
tpm_vtpm_proxy.c tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation 2023-08-11 11:45:19 +02:00
tpmrm-dev.c tpm: Unify the mismatching TPM space buffer sizes 2020-09-03 11:24:31 +02:00
xen-tpmfront.c