From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Alexander Steffen <Alexander.Steffen@infineon.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1.y 1/2] tpm_tis: Move CRC check to generic send routine
Date: Fri, 8 May 2026 13:24:28 -0400 [thread overview]
Message-ID: <20260508172429.1767444-1-sashal@kernel.org> (raw)
In-Reply-To: <2026050324-jump-diploma-db0f@gregkh>
From: Alexander Steffen <Alexander.Steffen@infineon.com>
[ 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.
Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Stable-dep-of: 949692da7211 ("tpm: tpm_tis: stop transmit if retries are exhausted")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/char/tpm/tpm_tis_core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 968b891bcb030..88a85aff3cb82 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -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)
--
2.53.0
next prev parent reply other threads:[~2026-05-08 17:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-03 11:47 FAILED: patch "[PATCH] tpm: tpm_tis: stop transmit if retries are exhausted" failed to apply to 6.1-stable tree gregkh
2026-05-08 17:24 ` Sasha Levin [this message]
2026-05-08 17:24 ` [PATCH 6.1.y 2/2] tpm: tpm_tis: stop transmit if retries are exhausted Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260508172429.1767444-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Alexander.Steffen@infineon.com \
--cc=jarkko@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox