Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tpm: tpm_tis: stop transmit if retries are exhausted

tpm_tis_send_main() will attempt to retry sending data TPM_RETRY times.
Currently, if those retries are exhausted, the driver will attempt to
call execute. The TPM will be in the wrong state, leading to the
operation simply timing out.

Instead, if there is still an error after retries are exhausted, return
that error immediately.

Cc: stable@vger.kernel.org # v6.6+
Fixes: 280db21e153d8 ("tpm_tis: Resend command to recover from data transfer errors")
Signed-off-by: Jacqueline Wong <jacqwong@google.com>
Signed-off-by: Jordan Hand <jhand@google.com>
Link: https://lore.kernel.org/r/20260415160006.2275325-3-jacqwong@google.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>

authored by

Jacqueline Wong and committed by
Jarkko Sakkinen
949692da 0471921e

+6 -1
+6 -1
drivers/char/tpm/tpm_tis_core.c
··· 556 556 break; 557 557 else if (rc != -EAGAIN && rc != -EIO) 558 558 /* Data transfer failed, not recoverable */ 559 - return rc; 559 + goto out_err; 560 560 561 561 usleep_range(priv->timeout_min, priv->timeout_max); 562 + } 563 + 564 + if (rc == -EAGAIN || rc == -EIO) { 565 + dev_err(&chip->dev, "Exhausted %d tpm_tis_send_data retries\n", TPM_RETRY); 566 + goto out_err; 562 567 } 563 568 564 569 /* go and do it */