summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorPeter Huewe <peter.huewe@infineon.com>2017-03-02 14:03:12 +0100
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-04-03 21:46:01 +0200
commit975094ddc369a32f27210248bdd9bbd153061b00 (patch)
treea6368da8b555ef4c3ce5b5cd55637c8ad9ff0ede /drivers/char/tpm
parenttpm_tis_spi: Use single function to transfer data (diff)
downloadlinux-975094ddc369a32f27210248bdd9bbd153061b00.tar.xz
linux-975094ddc369a32f27210248bdd9bbd153061b00.zip
tpm_tis_spi: Abort transfer when too many wait states are signaled
Abort the transfer with ETIMEDOUT when the TPM signals more than TPM_RETRY wait states. Continuing with the transfer in this state will only lead to arbitrary failures in other parts of the code. Cc: <stable@vger.kernel.org> Fixes: 0edbfea537d1 ("tpm/tpm_tis_spi: Add support for spi phy") Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com> Signed-off-by: Peter Huewe <peter.huewe@infineon.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Benoit Houyere <benoit.houyere@st.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm_tis_spi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
index 062799e04f04..639614f2d415 100644
--- a/drivers/char/tpm/tpm_tis_spi.c
+++ b/drivers/char/tpm/tpm_tis_spi.c
@@ -101,6 +101,11 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
goto exit;
}
+ if (i == TPM_RETRY) {
+ ret = -ETIMEDOUT;
+ goto exit;
+ }
+
spi_xfer.cs_change = 0;
spi_xfer.len = len;