linux-yocto/security/keys
Jarkko Sakkinen 04a3aa6e8c tpm2-sessions: Fix out of range indexing in name_size
commit 6e9722e9a7bfe1bbad649937c811076acf86e1fd upstream.

'name_size' does not have any range checks, and it just directly indexes
with TPM_ALG_ID, which could lead into memory corruption at worst.

Address the issue by only processing known values and returning -EINVAL for
unrecognized values.

Make also 'tpm_buf_append_name' and 'tpm_buf_fill_hmac_session' fallible so
that errors are detected before causing any spurious TPM traffic.

End also the authorization session on failure in both of the functions, as
the session state would be then by definition corrupted.

Cc: stable@vger.kernel.org # v6.10+
Fixes: 1085b8276b ("tpm: Add the rest of the session HMAC API")
Reviewed-by: Jonathan McDowell <noodles@meta.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-01-02 12:57:11 +01:00
..
encrypted-keys KEYS: encrypted: Use SHA-256 library instead of crypto_shash 2025-10-04 17:25:35 +03:00
trusted-keys tpm2-sessions: Fix out of range indexing in name_size 2026-01-02 12:57:11 +01:00
big_key.c
compat_dh.c
compat.c
dh.c
gc.c
internal.h
Kconfig security: keys: use menuconfig for KEYS symbol 2025-10-04 17:25:35 +03:00
key.c
keyctl_pkey.c
keyctl.c
keyring.c
Makefile
permission.c
persistent.c
proc.c
process_keys.c
request_key_auth.c
request_key.c
sysctl.c
user_defined.c