Commit c34b04cc authored by Denis Arefev's avatar Denis Arefev Committed by Takashi Iwai
Browse files

ALSA: hda: cs35l41: Fix NULL pointer dereference in cs35l41_hda_read_acpi()



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: 7b2f3eb4 ("ALSA: hda: cs35l41: Add support for CS35L41 in HDA systems")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDenis Arefev <arefev@swemel.ru>
Reviewed-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20251202101338.11437-1-arefev@swemel.ru
parent eaf526cf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1901,6 +1901,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))