]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tpm2-sessions: Fix tpm2_read_public range checks
authorJarkko Sakkinen <jarkko@kernel.org>
Mon, 1 Dec 2025 13:38:02 +0000 (15:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:11 +0000 (12:57 +0100)
commit20eda7c74b69fe9e1caf9b930a5c016bf8d755fa
treead495eb4aa99b5c3ceeeea9c631e21a8c09104c7
parent04a3aa6e8c5f878cc51a8a1c90b6d3c54079bc43
tpm2-sessions: Fix tpm2_read_public range checks

commit bda1cbf73c6e241267c286427f2ed52b5735d872 upstream.

tpm2_read_public() has some rudimentary range checks but the function does
not ensure that the response buffer has enough bytes for the full TPMT_HA
payload.

Re-implement the function with necessary checks and validation, and return
name and name size for all handle types back to the caller.

Cc: stable@vger.kernel.org # v6.10+
Fixes: d0a25bb961e6 ("tpm: Add HMAC session name/handle append")
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: Jonathan McDowell <noodles@meta.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm2-cmd.c
drivers/char/tpm/tpm2-sessions.c