FAILED: patch "[PATCH] tpm: tpm_tis: stop transmit if retries are exhausted" failed to apply to 6.1-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 949692da7211572fac419b2986b6abc0cd1aeb76
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026050324-jump-diploma-db0f@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 949692da7211572fac419b2986b6abc0cd1aeb76 Mon Sep 17 00:00:00 2001
From: Jacqueline Wong <[email protected]>
Date: Wed, 15 Apr 2026 16:00:06 +0000
Subject: [PATCH] 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.
drivers/char/tpm/tpm_tis_core.c +6 -1
@@ -556,11 +556,16 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)break ; else if (rc != -EAGAIN && rc != -EIO)/* Data transfer failed, not recoverable */ -return rc; + goto out_err;usleep_range (priv->timeout_min, priv->timeout_max); } +if (rc == -EAGAIN || rc == -EIO ) { +dev_err (&chip->dev,"Exhausted %d tpm_tis_send_data retries\n" ,TPM_RETRY ); + goto out_err; + } +/* go and do it */ rc =tpm_tis_write8 (priv,TPM_STS (priv->locality),TPM_STS_GO );if (rc <0 )
Sasha Levin
maintainerPATCH 1/2 tpm_tis: Move CRC check to generic send routine
From: Alexander Steffen <[email protected]>
[ Upstream commit 32a0c860ff48543299772f7a98f32dd3ee9281b7 ]
The CRC functionality is initialized before tpm_tis_core, so it can be used on all code paths within the module. Therefore, move the CRC check to the generic send routine, that also contains all other checks for successful command transmission, so that all those checks are in one place.
Also, this ensures that tpm_tis_ready is called when a CRC failure is detected, to clear the invalid data from the TPM, which did not happen previously.
Stable-dep-of: 949692da7211 ("tpm: tpm_tis: stop transmit if retries are exhausted")
--- drivers/char/tpm/tpm_tis_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/char/tpm/tpm_tis_core.c +6 -6
@@ -464,6 +464,12 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len) goto out_err; } + rc =tpm_tis_verify_crc (priv, len, buf); +if (rc <0 ) { +dev_err (&chip->dev,"CRC mismatch for command.\n" ); + goto out_err; + } +return 0 ; out_err:
@@ -517,12 +523,6 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)usleep_range (priv->timeout_min, priv->timeout_max); } - rc =tpm_tis_verify_crc (priv, len, buf); -if (rc <0 ) { -dev_err (&chip->dev,"CRC mismatch for command.\n" ); -return rc; - } -/* go and do it */ rc =tpm_tis_write8 (priv,TPM_STS (priv->locality),TPM_STS_GO );if (rc <0 )
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 tpm: tpm_tis: stop transmit if retries are exhausted
From: Jacqueline Wong <[email protected]>
[ Upstream commit 949692da7211572fac419b2986b6abc0cd1aeb76 ]
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.
--- drivers/char/tpm/tpm_tis_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +6 -1
@@ -518,11 +518,16 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)break ; else if (rc != -EAGAIN && rc != -EIO)/* Data transfer failed, not recoverable */ -return rc; + goto out_err;usleep_range (priv->timeout_min, priv->timeout_max); } +if (rc == -EAGAIN || rc == -EIO ) { +dev_err (&chip->dev,"Exhausted %d tpm_tis_send_data retries\n" ,TPM_RETRY ); + goto out_err; + } +/* go and do it */ rc =tpm_tis_write8 (priv,TPM_STS (priv->locality),TPM_STS_GO );if (rc <0 )
Signature · 1 line
2.53.0