ALSA: hda: Skip codec shutdown in case the codec is not registered
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Tue, 1 Feb 2022 11:21:44 +0000 (13:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 17:34:07 +0000 (18:34 +0100)
commite4b74b89862c3ae6006a15b40c716ab9fc9f9f72
treec0baf19fb06365d9cca7d3b3e8a71e1b2b4e8ebd
parent0c5c643356573ab8c8d11e13123b5da0f910350a
ALSA: hda: Skip codec shutdown in case the codec is not registered

commit 1c7f0e349aa5f8f80b1cac3d4917405332e14cdf upstream.

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 <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Tested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Fixes: b98444ed597d ("ALSA: hda: Suspend codec at shutdown")
Link: https://lore.kernel.org/r/20220201112144.29411-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/pci/hda/hda_codec.c