Skip to content

Commit f92cc1d

Browse files
jacquelinewonggregkh
authored andcommitted
tpm: tpm_tis: stop transmit if retries are exhausted
commit 949692d upstream. 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: 280db21 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2e0fd1c commit f92cc1d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/char/tpm/tpm_tis_core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,11 +557,16 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)
557557
break;
558558
else if (rc != -EAGAIN && rc != -EIO)
559559
/* Data transfer failed, not recoverable */
560-
return rc;
560+
goto out_err;
561561

562562
usleep_range(priv->timeout_min, priv->timeout_max);
563563
}
564564

565+
if (rc == -EAGAIN || rc == -EIO) {
566+
dev_err(&chip->dev, "Exhausted %d tpm_tis_send_data retries\n", TPM_RETRY);
567+
goto out_err;
568+
}
569+
565570
/* go and do it */
566571
rc = tpm_tis_write8(priv, TPM_STS(priv->locality), TPM_STS_GO);
567572
if (rc < 0)

0 commit comments

Comments
 (0)