[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1488459879-24349-3-git-send-email-peter.huewe@infineon.com>
Date: Thu, 2 Mar 2017 13:03:12 +0000
From: Peter Huewe <peter.huewe@...ineon.com>
To: <tpmdd-devel@...ts.sourceforge.net>
CC: Peter Huewe <peter.huewe@...ineon.com>, <stable@...r.kernel.org>,
Alexander Steffen <Alexander.Steffen@...ineon.com>,
Peter Huewe <peterhuewe@....de>,
Marcel Selhorst <tpmdd@...horst.net>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH v2 2/5] 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@...r.kernel.org>
Fixes: 0edbfea537d1 ("tpm/tpm_tis_spi: Add support for spi phy")
Signed-off-by: Alexander Steffen <Alexander.Steffen@...ineon.com>
Signed-off-by: Peter Huewe <peter.huewe@...ineon.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Tested-by: Benoit Houyere <benoit.houyere@...com>
---
drivers/char/tpm/tpm_tis_spi.c | 5 +++++
1 file changed, 5 insertions(+)
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;
--
2.7.4
Powered by blists - more mailing lists