summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorJiangshan Yi <yijiangshan@kylinos.cn>2026-09-03 11:58:37 +0800
committerJarkko Sakkinen <jarkko@kernel.org>2026-09-29 22:15:21 +0300
commit9b522400bf5c082feb9a0037a053ea822a2c7e4d (patch)
tree4f33ec63997d36e72c216d801d17c7f74df77eb9 /tools/lib/python
parent1e2f9a611b334ce6ed1dc4a9e1587c7a11d2be30 (diff)
downloadlinux-next-9b522400bf5c082feb9a0037a053ea822a2c7e4d.tar.gz
linux-next-9b522400bf5c082feb9a0037a053ea822a2c7e4d.zip
tpm: fix off-by-four bounds check in tpm2_get_random()
When the response carries the TPM2_ST_SESSIONS tag, tpm2_get_random() skips the 4-byte parameter size field before locating the random data, but the bounds check still validates the response length against TPM_HEADER_SIZE. A truncated response can pass the check and make memcpy() read up to 4 bytes past the response end, so stale buffer contents end up in the caller's random bytes. Fix this by checking the response length against 'offset', which already includes the skipped parameter size field. Cc: stable@vger.kernel.org # v6.12+ Fixes: 1b6d7f9eb150 ("tpm: add session encryption protection to tpm2_get_random()") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://sashiko.dev/#/patchset/20260902074839.417419-1-yijiangshan%40kylinos.cn Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lore.kernel.org/r/20260903035837.219284-1-yijiangshan@kylinos.cn Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions