]> Gentwo Git Trees - linux/.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)
committerJarkko Sakkinen <jarkko@kernel.org>
Fri, 5 Dec 2025 04:42:44 +0000 (06:42 +0200)
commitbda1cbf73c6e241267c286427f2ed52b5735d872
tree0ec5dbc502caca85d9c5630a9b910c482af7e2fa
parent6e9722e9a7bfe1bbad649937c811076acf86e1fd
tpm2-sessions: Fix tpm2_read_public range checks

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>
drivers/char/tpm/tpm2-cmd.c
drivers/char/tpm/tpm2-sessions.c