[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aTfNl2nhJkjcOG5J@kernel.org>
Date: Tue, 9 Dec 2025 09:19:51 +0200
From: Jarkko Sakkinen <jarkko@...nel.org>
To: linux-integrity@...r.kernel.orgg
Cc: James Bottomley <James.Bottomley@...senpartnership.com>,
Mimi Zohar <zohar@...ux.ibm.com>,
David Howells <dhowells@...hat.com>,
Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>,
"open list:KEYS-TRUSTED" <keyrings@...r.kernel.org>,
"open list:SECURITY SUBSYSTEM" <linux-security-module@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] KEYS: trusted: Don't use 'buf->handles'
On Tue, Dec 09, 2025 at 09:11:43AM +0200, Jarkko Sakkinen wrote:
> tpm2_unseal_trusted() deduces number of handles in run-time even tho the
> expected value is known at compile time. Address the issue.
>
> Signed-off-by: Jarkko Sakkinen <jarkko@...nel.org>
> ---
> security/keys/trusted-keys/trusted_tpm2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/keys/trusted-keys/trusted_tpm2.c b/security/keys/trusted-keys/trusted_tpm2.c
> index 9074ae1a5896..e78061ee2d99 100644
> --- a/security/keys/trusted-keys/trusted_tpm2.c
> +++ b/security/keys/trusted-keys/trusted_tpm2.c
> @@ -491,7 +491,7 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip,
> if (tpm2_chip_auth(chip)) {
> tpm_buf_append_hmac_session(chip, buf, TPM2_SA_ENCRYPT, NULL, 0);
> } else {
> - offset = buf->handles * 4 + TPM_HEADER_SIZE;
> + offset = TPM_HEADER_SIZE + 2 * sizeof(u32);
Oops.
Should be 'TPM_HEADER_SIZE + sizeof(u32)'. There's just a single handle.
> head = (struct tpm_header *)buf->data;
> if (tpm_buf_length(buf) == offset)
> head->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
> --
> 2.39.5
>
BR, Jarkko
Powered by blists - more mailing lists