linux/sound/hda
Denis Arefev 47d1b9ca92 ALSA: hda: Fix missing pointer check in hda_component_manager_init function
commit 1cf11d80db upstream.

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); // dereference

Add IS_ERR() check to prevent the crash.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: ae7abe36e3 ("ALSA: hda/realtek: Add CS35L41 support for Thinkpad laptops")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-10-23 16:24:25 +02:00
..
codecs ALSA: hda: Fix missing pointer check in hda_component_manager_init function 2025-10-23 16:24:25 +02:00
common ALSA: hda: Use safer strscpy() instead of strcpy() 2025-07-11 13:36:20 +02:00
controllers ALSA: hda/intel: Add MSI X870E Tomahawk to denylist 2025-10-23 16:24:24 +02:00
core ALSA: hda: intel-dsp-config: Prevent SEGFAULT if ACPI_HANDLE() is NULL 2025-09-17 18:19:04 +02:00
Kconfig ALSA: hda: Move codec drivers into sound/hda/codecs directory 2025-07-11 09:55:37 +02:00
Makefile ALSA: hda: Drop old codec binding method 2025-07-11 09:55:38 +02:00