CVE-2025-40097: ALSA: hda: Fix missing pointer check in hda_component_manager_init function
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ALSA: hda: Fix missing pointer check in hda_component_manager_init function
The __component_match_add function may assign the 'matchptr' pointer the value ERR_PTR(-ENOMEM), which will subsequently be dereferenced.
The call stack leading to the error looks like this:
hda_component_manager_init
|-> component_match_add
|-> component_match_add_release
|-> __component_match_add ( ... ,**matchptr, ... )
|-> *matchptr = ERR_PTR(-ENOMEM); // assign
|-> component_master_add_with_match( ... match)
|-> component_match_realloc(match, match->num); // dereferenceAdd IS_ERR() check to prevent the crash.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
The Linux kernel CVE team has assigned CVE-2025-40097 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.17 with commit ae7abe36e352eddf8e30d3b1ea3fb402514ba13b and fixed in 6.17.5 with commit 47d1b9ca923b55c3f407788f1f15b04957e0e027 Issue introduced in 5.17 with commit ae7abe36e352eddf8e30d3b1ea3fb402514ba13b and fixed in 6.18-rc2 with commit 1cf11d80db5df805b538c942269e05a65bcaf5bc
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-2025-40097
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:
sound/hda/codecs/side-codecs/hda_component.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/47d1b9ca923b55c3f407788f1f15b04957e0e027 https://git.kernel.org/stable/c/1cf11d80db5df805b538c942269e05a65bcaf5bc