]> Git Repo - linux.git/commitdiff
tpm: Add check for Failure mode for TPM2 modules
authorMårten Lindahl <[email protected]>
Mon, 1 Aug 2022 13:57:03 +0000 (15:57 +0200)
committerJarkko Sakkinen <[email protected]>
Wed, 3 Aug 2022 20:56:20 +0000 (23:56 +0300)
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.

Fixes: 0aa698787aa2 ("tpm: Add Upgrade/Reduced mode support for TPM2 modules")
Cc: [email protected] # v5.17+
Signed-off-by: Mårten Lindahl <[email protected]>
Reviewed-by: Jarkko Sakkinen <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
drivers/char/tpm/tpm2-cmd.c

index c1eb5d223839579e087a27774bf3adb9f2b45f21..65d03867e114c563de61fbb6e06cbfe4505cfd99 100644 (file)
@@ -752,6 +752,12 @@ int tpm2_auto_startup(struct tpm_chip *chip)
        }
 
        rc = tpm2_get_cc_attrs_tbl(chip);
+       if (rc == TPM2_RC_FAILURE || (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:
        /*
This page took 0.050816 seconds and 4 git commands to generate.