All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Srish Srinivasan <ssrish@linux.ibm.com>
Cc: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
	James.Bottomley@hansenpartnership.com, zohar@linux.ibm.com,
	stefanb@linux.ibm.com, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, nayna@linux.ibm.com,
	rnsastry@linux.ibm.com, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] keys/trusted_keys: return immediately after TPM unseal failure
Date: Thu, 10 Sep 2026 01:02:44 +0300	[thread overview]
Message-ID: <aqHXhOrIbtMdGGoi@kernel.org> (raw)
In-Reply-To: <20260902230305.118931-2-ssrish@linux.ibm.com>

On Thu, Sep 03, 2026 at 04:33:04AM +0530, Srish Srinivasan wrote:
> trusted_tpm_unseal() proceeds to pcrlock() when the TPM unseal operation
> fails. If pcrlock() succeeds, its return value overwrites the unseal error,
> causing key instantiation to succeed.
> 
> Return immediately when unseal fails to preserve the original error.
> 
> Fixes: 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")
> Cc: stable@vger.kernel.org
> Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
> ---
>  security/keys/trusted-keys/trusted_tpm1.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/security/keys/trusted-keys/trusted_tpm1.c b/security/keys/trusted-keys/trusted_tpm1.c
> index bf0bf7f36970..9cdfeea800a3 100644
> --- a/security/keys/trusted-keys/trusted_tpm1.c
> +++ b/security/keys/trusted-keys/trusted_tpm1.c
> @@ -923,8 +923,10 @@ static int trusted_tpm_unseal(struct trusted_key_payload *p, char *datablob)
>  		ret = tpm2_unseal_trusted(chip, p, options);
>  	else
>  		ret = key_unseal(p, options);
> -	if (ret < 0)
> +	if (ret < 0) {
>  		pr_info("key_unseal failed (%d)\n", ret);
> +		goto out;
> +	}
>  
>  	if (options->pcrlock) {
>  		ret = pcrlock(options->pcrlock);
> -- 
> 2.53.0
> 


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

  reply	other threads:[~2026-09-09 22:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 23:03 [PATCH v7 0/2] Move TPM-specific fields out of trusted_key_options Srish Srinivasan
2026-09-02 23:03 ` [PATCH v2 1/2] keys/trusted_keys: return immediately after TPM unseal failure Srish Srinivasan
2026-09-09 22:02   ` Jarkko Sakkinen [this message]
2026-09-02 23:03 ` [PATCH v7 2/2] keys/trusted_keys: move TPM-specific fields into struct trusted_key_tpm Srish Srinivasan
2026-09-09 22:38   ` Jarkko Sakkinen
2026-09-10  6:55     ` Srish Srinivasan
2026-09-11 21:42     ` Jarkko Sakkinen
2026-09-12  6:19       ` Srish Srinivasan

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=aqHXhOrIbtMdGGoi@kernel.org \
    --to=jarkko@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=nayna@linux.ibm.com \
    --cc=rnsastry@linux.ibm.com \
    --cc=ssrish@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=stefanb@linux.ibm.com \
    --cc=zohar@linux.ibm.com \
    /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 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.