Skip to contentSkip to conversation

CVE-2024-41039: firmware: cs_dsp: Fix overflow checking of wmfw header

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jul 29, 2024

lore
Share & tools
lore
#0 lore raw

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

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

firmware: cs_dsp: Fix overflow checking of wmfw header

Fix the checking that firmware file buffer is large enough for the wmfw header, to prevent overrunning the buffer.

The original code tested that the firmware data buffer contained enough bytes for the sums of the size of the structs

wmfw_header + wmfw_adsp1_sizes + wmfw_footer

But wmfw_adsp1_sizes is only used on ADSP1 firmware. For ADSP2 and Halo Core the equivalent struct is wmfw_adsp2_sizes, which is 4 bytes longer. So the length check didn't guarantee that there are enough bytes in the firmware buffer for a header with wmfw_adsp2_sizes.

This patch splits the length check into three separate parts. Each of the wmfw_header, wmfw_adsp?_sizes and wmfw_footer are checked separately before they are used.

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

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

	Issue introduced in 5.16 with commit f6bc909e7673 and fixed in 6.1.100 with commit fd035f0810b3
	Issue introduced in 5.16 with commit f6bc909e7673 and fixed in 6.6.41 with commit 9c9877a96e03
	Issue introduced in 5.16 with commit f6bc909e7673 and fixed in 6.9.10 with commit 49a79f344d0a
	Issue introduced in 5.16 with commit f6bc909e7673 and fixed in 6.10 with commit 3019b86bce16

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-41039

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/firmware/cirrus/cs_dsp.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/fd035f0810b33c2a8792effdb82bf35920221565
	https://git.kernel.org/stable/c/9c9877a96e033bf6c6470b3b4f06106d91ace11e
	https://git.kernel.org/stable/c/49a79f344d0a17c6a5eef53716cc76fcdbfca9ba
	https://git.kernel.org/stable/c/3019b86bce16fbb5bc1964f3544d0ce7d0137278