New issue
Advanced search Search tips

Issue 856760 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

tpm_i2c_infineon: properly handle wait_for_stat errors

Project Member Reported by apronin@chromium.org, Jun 26 2018

Issue description

[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).
 
Owner: apronin@chromium.org
Status: Assigned (was: Untriaged)
Components: OS>Kernel>TPM

Sign in to add a comment