public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm: Start the tpm2 before running a self test.
@ 2023-11-22  6:55 Hermin Anggawijaya
  2023-11-22  7:10 ` Paul Menzel
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Hermin Anggawijaya @ 2023-11-22  6:55 UTC (permalink / raw)
  To: peterhuewe, jarkko, jgg; +Cc: linux-integrity, linux-kernel, Hermin Anggawijaya

Before sending a command to attempt the self test, the TPM
may need to be started, otherwise the self test returns
TPM2_RC_INITIALIZE value causing a log as follows:
"tpm tpm0: A TPM error (256) occurred attempting the self test".

Signed-off-by: Hermin Anggawijaya <hermin.anggawijaya@alliedtelesis.co.nz>
---
 drivers/char/tpm/tpm2-cmd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 93545be190a5..0530f3b5f86a 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -737,15 +737,15 @@ int tpm2_auto_startup(struct tpm_chip *chip)
 	if (rc)
 		goto out;
 
+	rc = tpm2_startup(chip);
+	if (rc && rc != TPM2_RC_INITIALIZE)
+		goto out;
+
 	rc = tpm2_do_selftest(chip);
 	if (rc && rc != TPM2_RC_INITIALIZE)
 		goto out;
 
 	if (rc == TPM2_RC_INITIALIZE) {
-		rc = tpm2_startup(chip);
-		if (rc)
-			goto out;
-
 		rc = tpm2_do_selftest(chip);
 		if (rc)
 			goto out;
-- 
2.43.0


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

end of thread, other threads:[~2024-07-15 17:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22  6:55 [PATCH] tpm: Start the tpm2 before running a self test Hermin Anggawijaya
2023-11-22  7:10 ` Paul Menzel
2023-11-26 21:16   ` Angga
2023-11-22 12:34 ` Stefan Berger
2023-11-27  2:02   ` Angga
2023-12-04  2:36     ` Jarkko Sakkinen
2023-11-24  1:42 ` Jarkko Sakkinen
2023-11-27  2:07   ` Angga
2024-07-15 17:39   ` Francesco Dolcini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox