From: Jarkko Sakkinen <jarkko@kernel.org>
To: "Mårten Lindahl" <marten.lindahl@axis.com>
Cc: Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
linux-integrity@vger.kernel.org, kernel@axis.com,
stable@vger.kernel.org
Subject: Re: [PATCH v4] tpm: Add check for Failure mode for TPM2 modules
Date: Mon, 1 Aug 2022 19:50:43 +0300 [thread overview]
Message-ID: <YugEY6Wec3DpW9o2@kernel.org> (raw)
In-Reply-To: <20220801135703.26754-1-marten.lindahl@axis.com>
On Mon, Aug 01, 2022 at 03:57:03PM +0200, Mårten Lindahl wrote:
> 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: stable@vger.kernel.org # v5.17+
> Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com>
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> ---
>
> v4:
> - Resend of patch because of invalid characters in Signed-off-by tag.
>
> v3:
> - Add Jarkkos Reviewed-by tag.
> - Add Fixes tag and Cc.
>
> v2:
> - Add missed check for TPM error code.
>
> drivers/char/tpm/tpm2-cmd.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> index c1eb5d223839..65d03867e114 100644
> --- a/drivers/char/tpm/tpm2-cmd.c
> +++ b/drivers/char/tpm/tpm2-cmd.c
> @@ -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:
> /*
> --
> 2.30.2
>
Thank you, applied.
BR, Jarkko
prev parent reply other threads:[~2022-08-01 16:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 13:57 [PATCH v4] tpm: Add check for Failure mode for TPM2 modules Mårten Lindahl
2022-08-01 16:50 ` Jarkko Sakkinen [this message]
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=YugEY6Wec3DpW9o2@kernel.org \
--to=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kernel@axis.com \
--cc=linux-integrity@vger.kernel.org \
--cc=marten.lindahl@axis.com \
--cc=peterhuewe@gmx.de \
--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