]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: hda: cs35l41: Fix NULL pointer dereference in cs35l41_hda_read_acpi()
authorDenis Arefev <arefev@swemel.ru>
Tue, 16 Dec 2025 11:00:34 +0000 (06:00 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:26 +0000 (10:14 +0100)
[ Upstream commit c34b04cc6178f33c08331568c7fd25c5b9a39f66 ]

The acpi_get_first_physical_node() function can return NULL, in which
case the get_device() function also returns NULL, but this value is
then dereferenced without checking,so add a check to prevent a crash.

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

Fixes: 7b2f3eb492da ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20251202101338.11437-1-arefev@swemel.ru
[ sound/hda/codecs/side-codecs/ -> sound/pci/hda/ ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/pci/hda/cs35l41_hda.c

index d68bf7591d90c19a601499d9c20612d8c1a12603..e115b9bd7ce3dfe12de9f95ffa66d46e10619cf5 100644 (file)
@@ -1865,6 +1865,8 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
 
        cs35l41->dacpi = adev;
        physdev = get_device(acpi_get_first_physical_node(adev));
+       if (!physdev)
+               return -ENODEV;
 
        sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
        if (IS_ERR(sub))