]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ALSA: hda: cs35l41: Possible null pointer dereference in cs35l41_hda_unbind()
authorSimon Trimmer <simont@opensource.cirrus.com>
Fri, 31 May 2024 12:08:20 +0000 (13:08 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 31 May 2024 12:38:41 +0000 (14:38 +0200)
The cs35l41_hda_unbind() function clears the hda_component entry
matching it's index and then dereferences the codec pointer held in the
first element of the hda_component array, this is an issue when the
device index was 0.

Instead use the codec pointer stashed in the cs35l41_hda structure as it
will still be valid.

Fixes: 7cf5ce66dfda ("ALSA: hda: cs35l41: Add device_link between HDA and cs35l41_hda")
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240531120820.35367-1-simont@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/cs35l41_hda.c

index 6c49e5c6cd20883c2b540e1db85f62a6e2f4e2a7..d54d4d60b03ec7344bf704ba5305357fecc91748 100644 (file)
@@ -1495,7 +1495,7 @@ static void cs35l41_hda_unbind(struct device *dev, struct device *master, void *
        if (comps[cs35l41->index].dev == dev) {
                memset(&comps[cs35l41->index], 0, sizeof(*comps));
                sleep_flags = lock_system_sleep();
-               device_link_remove(&comps->codec->core.dev, cs35l41->dev);
+               device_link_remove(&cs35l41->codec->core.dev, cs35l41->dev);
                unlock_system_sleep(sleep_flags);
        }
 }