summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Arefev <arefev@swemel.ru>2025-12-02 13:13:36 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-18 14:00:16 +0100
commitc28946b7409b7b68fb0481ec738c8b04578b11c6 (patch)
tree9fea2bef79f1e177022f11ed25946d56343bcf53
parentaa463ec2fff179a539d7f6e8c11c8fce57b7aa44 (diff)
downloadlinux-c28946b7409b7b68fb0481ec738c8b04578b11c6.tar.gz
linux-c28946b7409b7b68fb0481ec738c8b04578b11c6.tar.bz2
linux-c28946b7409b7b68fb0481ec738c8b04578b11c6.zip
ALSA: hda: cs35l41: Fix NULL pointer dereference in cs35l41_hda_read_acpi()
commit c34b04cc6178f33c08331568c7fd25c5b9a39f66 upstream. 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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/hda/codecs/side-codecs/cs35l41_hda.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda.c b/sound/hda/codecs/side-codecs/cs35l41_hda.c
index 0ef77fae0402..8d0cfe0a7ecb 100644
--- a/sound/hda/codecs/side-codecs/cs35l41_hda.c
+++ b/sound/hda/codecs/side-codecs/cs35l41_hda.c
@@ -1917,6 +1917,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))