Skip to content
Commit de13c56f authored by Matthew R. Ochs's avatar Matthew R. Ochs Committed by Greg Kroah-Hartman
Browse files

tpm_tis_spi: Account for SPI header when allocating TPM SPI xfer buffer

[ Upstream commit 195aba96 ]

The TPM SPI transfer mechanism uses MAX_SPI_FRAMESIZE for computing the
maximum transfer length and the size of the transfer buffer. As such, it
does not account for the 4 bytes of header that prepends the SPI data
frame. This can result in out-of-bounds accesses and was confirmed with
KASAN.

Introduce SPI_HDRSIZE to account for the header and use to allocate the
transfer buffer.

Fixes: a86a42ac

 ("tpm_tis_spi: Add hardware wait polling")
Signed-off-by: default avatarMatthew R. Ochs <mochs@nvidia.com>
Tested-by: default avatarCarol Soto <csoto@nvidia.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4ed468ed
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment