aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Ujfalusi <[email protected]>2022-02-01 13:21:44 +0200
committerTakashi Iwai <[email protected]>2022-02-01 15:18:17 +0100
commit1c7f0e349aa5f8f80b1cac3d4917405332e14cdf (patch)
tree3b7404cab2ee6ec501dca68f21c04d00d078aca7
parent4ee02e20893d2f9e951c7888f2284fa608ddaa35 (diff)
ALSA: hda: Skip codec shutdown in case the codec is not registered
If the codec->registered is not set then it means that pm_runtime is not yet enabled and the codec->pcm_list_head has not been initialized. The access to the not initialized pcm_list_head will lead a kernel crash during shutdown. Reported-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Tested-by: Guennadi Liakhovetski <[email protected]> Fixes: b98444ed597d ("ALSA: hda: Suspend codec at shutdown") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
-rw-r--r--sound/pci/hda/hda_codec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 7016b48227bf..f552785d301e 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3000,6 +3000,10 @@ void snd_hda_codec_shutdown(struct hda_codec *codec)
{
struct hda_pcm *cpcm;
+ /* Skip the shutdown if codec is not registered */
+ if (!codec->registered)
+ return;
+
list_for_each_entry(cpcm, &codec->pcm_list_head, list)
snd_pcm_suspend_all(cpcm->pcm);