Skip to content

Commit 863ed94

Browse files
martenlijarkkojs
authored andcommitted
tpm: Add check for Failure mode for TPM2 modules
In commit 0aa6987 ("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: 0aa6987 ("tpm: Add Upgrade/Reduced mode support for TPM2 modules") Cc: stable@vger.kernel.org # v5.17+ Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
1 parent bed4593 commit 863ed94

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/char/tpm/tpm2-cmd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,12 @@ int tpm2_auto_startup(struct tpm_chip *chip)
752752
}
753753

754754
rc = tpm2_get_cc_attrs_tbl(chip);
755+
if (rc == TPM2_RC_FAILURE || (rc < 0 && rc != -ENOMEM)) {
756+
dev_info(&chip->dev,
757+
"TPM in field failure mode, requires firmware upgrade\n");
758+
chip->flags |= TPM_CHIP_FLAG_FIRMWARE_UPGRADE;
759+
rc = 0;
760+
}
755761

756762
out:
757763
/*

0 commit comments

Comments
 (0)