Skip to contentSkip to conversation

CVE-2024-36477: tpm_tis_spi: Account for SPI header when allocating TPM SPI xfer buffer

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jun 21, 2024

lore
Share & tools
lore
#0 lore raw

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

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

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.

The Linux kernel CVE team has assigned CVE-2024-36477 to this issue.

Affected and fixed versions
===========================

Issue introduced in 6.6 with commit a86a42ac2bd6 and fixed in 6.6.33 with commit 1547183852dc Issue introduced in 6.6 with commit a86a42ac2bd6 and fixed in 6.9.4 with commit de13c56f9947 Issue introduced in 6.6 with commit a86a42ac2bd6 and fixed in 6.10-rc2 with commit 195aba96b854

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2024-36477

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/char/tpm/tpm_tis_spi_main.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/1547183852dcdfcc25878db7dd3620509217b0cd
	https://git.kernel.org/stable/c/de13c56f99477b56980c7e00b09c776d16b7563d
	https://git.kernel.org/stable/c/195aba96b854dd664768f382cd1db375d8181f88