Linux Kernels

tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete

This change “tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete” (commit 442601e) in Linux kernel is authored by Jarkko Sakkinen <jarkko.sakkinen [at] linux.intel.com> on Fri Feb 8 18:30:59 2019 +0200.

Description of "tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete"

The change “tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete” introduces changes as follows.

tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete

Return -E2BIG when the transfer is incomplete. The upper layer does
not retry, so not doing that is incorrect behaviour.

Cc: stable@vger.kernel.org
Fixes: a2871c62e186 ("tpm: Add support for Atmel I2C TPMs")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>

Linux kernel releases containing commit 442601e

Linux kernel code changes in "tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete"

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/char/tpm/tpm_i2c_atmel.c | 4 ++++
 1 file changed, 4 insertions(+)
 
diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index 32a8e27c5382..cc4e642d3180 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -69,6 +69,10 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
 	if (status < 0)
 		return status;
 
+	/* The upper layer does not support incomplete sends. */
+	if (status != len)
+		return -E2BIG;
+
 	return 0;
 }
 

The commit for this change in Linux stable tree is 442601e (patch).

Last modified: 2020/01/11 09:41