[A complementary issue to issue 856757]
In tpm_i2c_infineon driver:
Let's assume wait_for_stat() is fixed (issue 856757), and correctly rejects invalid STS values while retrying to read it. If wait_for_stat() times out and returns -ETIME, its "int *status" output parameter contains the last value read from the TPM, i.e. that incorrect value in this case.
tpm_tis_i2c_recv() and tpm_tis_i2c_send() at the end of transmission call wait_for_stat() to test if VALID bit is set, and don't check the return value from wait_for_stat(). So, if it timed out due to continuously reading invalid STS values, they will just use that invalid status to test for other flags. And will incorrectly assume that DATA_AVAIL/DATA_EXPECT flag is set (if invalid value is 0xFF) and print a confusing error + return -EIO.
Check the return value of wait_for_stat(). In case of an error there:
- optionally retry,
- eventually log an appropriate message,
- reset the chip (tpm_tis_i2c_ready)
- still return an error for _send(), and ignore the error for _recv (? - the last part is questionable).
Comment 1 by apronin@chromium.org
, Jun 26 2018Status: Assigned (was: Untriaged)