All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm: Add check for Failure mode for TPM2 modules
@ 2022-04-25 10:25 Mårten Lindahl
  2022-04-25 14:03 ` Jarkko Sakkinen
  0 siblings, 1 reply; 9+ messages in thread
From: Mårten Lindahl @ 2022-04-25 10:25 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen
  Cc: Jason Gunthorpe, linux-integrity, kernel, Mårten Lindahl

In commit 0aa698787aa2 ("tpm: Add Upgrade/Reduced mode support for
TPM2 modules") it was said that:

"If the TPM is in Failure mode, it will successfully respond to both
tpm2_do_selftest() and tpm2_startup() calls. Although, will fail to
answer to tpm2_get_cc_attrs_tbl(). Use this fact to conclude that TPM
is in Failure mode."

But a check was never added in the commit when calling
tpm2_get_cc_attrs_tbl() to conclude that the TPM is in Failure mode.
This commit corrects this by adding a check.

Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com>
---
 drivers/char/tpm/tpm2-cmd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 4704fa553098..9da433521a0b 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -743,6 +743,11 @@ int tpm2_auto_startup(struct tpm_chip *chip)
 	}
 
 	rc = tpm2_get_cc_attrs_tbl(chip);
+	if (rc < 0 && rc != -ENOMEM) {
+		dev_info(&chip->dev, "TPM in field failure mode, requires firmware upgrade\n");
+		chip->flags |= TPM_CHIP_FLAG_FIRMWARE_UPGRADE;
+		rc = 0;
+	}
 
 out:
 	if (rc == TPM2_RC_UPGRADE) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-06-20 15:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25 10:25 [PATCH] tpm: Add check for Failure mode for TPM2 modules Mårten Lindahl
2022-04-25 14:03 ` Jarkko Sakkinen
2022-04-25 15:52   ` Marten Lindahl
2022-05-06 12:00     ` Stefan Mahnke-Hartmann
2022-05-09 13:47       ` Marten Lindahl
2022-05-30 15:26     ` Marten Lindahl
2022-06-01  2:05       ` Jarkko Sakkinen
2022-06-02 11:15         ` Jarkko Sakkinen
2022-06-20 14:59           ` Marten Lindahl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.