]> www.infradead.org Git - users/hch/misc.git/commitdiff
ALSA: hda: cs35l41: Fix NULL pointer dereference in cs35l41_get_acpi_mute_state()
authorDenis Arefev <arefev@swemel.ru>
Tue, 7 Oct 2025 07:38:31 +0000 (10:38 +0300)
committerTakashi Iwai <tiwai@suse.de>
Sat, 11 Oct 2025 06:28:36 +0000 (08:28 +0200)
Return value of a function acpi_evaluate_dsm() is dereferenced  without
checking for NULL, but it is usually checked for this function.

acpi_evaluate_dsm() may return NULL, when acpi_evaluate_object() returns
acpi_status other than ACPI_SUCCESS, so add a check to prevent the crach.

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

Fixes: 447106e92a0c ("ALSA: hda: cs35l41: Support mute notifications for CS35L41 HDA")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/codecs/side-codecs/cs35l41_hda.c

index c04208e685a05ea42b2ddeef4360fa195887ced1..c0f2a3ff77a1b6d2b10285e147cef5ed87f50efa 100644 (file)
@@ -1410,6 +1410,8 @@ static int cs35l41_get_acpi_mute_state(struct cs35l41_hda *cs35l41, acpi_handle
 
        if (cs35l41_dsm_supported(handle, CS35L41_DSM_GET_MUTE)) {
                ret = acpi_evaluate_dsm(handle, &guid, 0, CS35L41_DSM_GET_MUTE, NULL);
+               if (!ret)
+                       return -EINVAL;
                mute = *ret->buffer.pointer;
                dev_dbg(cs35l41->dev, "CS35L41_DSM_GET_MUTE: %d\n", mute);
        }