Skip to content

Commit 1c7f0e3

Browse files
ujfalusitiwai
authored andcommitted
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: b98444e ("ALSA: hda: Suspend codec at shutdown") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 4ee02e2 commit 1c7f0e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sound/pci/hda/hda_codec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,6 +3000,10 @@ void snd_hda_codec_shutdown(struct hda_codec *codec)
30003000
{
30013001
struct hda_pcm *cpcm;
30023002

3003+
/* Skip the shutdown if codec is not registered */
3004+
if (!codec->registered)
3005+
return;
3006+
30033007
list_for_each_entry(cpcm, &codec->pcm_list_head, list)
30043008
snd_pcm_suspend_all(cpcm->pcm);
30053009

0 commit comments

Comments
 (0)