linux-stable/sound
Cezary Rojewski f2bd1c5ae2 ALSA: hda: Fix page fault in snd_hda_codec_shutdown()
If early probe of HDAudio bus driver fails e.g.: due to missing
firmware file, snd_hda_codec_shutdown() ends in manipulating
uninitialized codec->pcm_list_head causing page fault.

Initialization of HDAudio codec in ASoC is split in two:
- snd_hda_codec_device_init()
- snd_hda_codec_device_new()

snd_hda_codec_device_init() is called during probe_codecs() by HDAudio
bus driver while snd_hda_codec_device_new() is called by
codec-component's ->probe(). The second call will not happen until all
components required by related sound card are present within the ASoC
framework. With firmware failing to load during the PCI's deferred
initialization i.e.: probe_work(), no platform components are ever
registered. HDAudio codec enumeration is done at that point though, so
the codec components became registered to ASoC framework, calling
snd_hda_codec_device_init() in the process.

Now, during platform reboot snd_hda_codec_shutdown() is called for every
codec found on the HDAudio bus causing oops if any of them has not
completed both of their initialization steps. Relocating field
initialization fixes the issue.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220816111727.3218543-7-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-08-18 09:47:19 +02:00
..
ac97 ALSA: ac97: Replace sprintf() with sysfs_emit() 2022-08-02 16:03:41 +02:00
aoa ALSA: aoa: Replace sprintf() with sysfs_emit() 2022-08-02 16:03:42 +02:00
arm ASoC: pxa: ac97: use normal MMIO accessors 2022-05-07 22:55:49 +02:00
atmel
core Merge branch 'for-linus' into for-next 2022-08-18 09:44:26 +02:00
drivers ALSA: Add generic serial MIDI driver using serial bus API 2022-05-12 11:54:13 +02:00
firewire ALSA: fireworks: fix wrong return count shorter than expected by 4 bytes 2022-04-25 08:03:49 +02:00
hda ALSA: hda: Remove codec init and exit routines 2022-08-18 09:47:09 +02:00
i2c
isa ALSA: wavefront: remove redundant assignment to pointer end 2022-07-04 14:29:27 +02:00
mips
oss
parisc
pci ALSA: hda: Fix page fault in snd_hda_codec_shutdown() 2022-08-18 09:47:19 +02:00
pcmcia
ppc
sh
soc ASoC: Intel: Drop hdac_ext usage for codec device creation 2022-08-18 09:46:43 +02:00
sparc
spi sound:spi: remove reference to AVR32 in Atmel AT73C213 DAC driver 2022-08-03 11:11:26 +02:00
synth
usb ALSA: usb-audio: make read-only array marker static const 2022-08-10 11:53:27 +02:00
virtio
x86 ALSA: x86: intel_hdmi_audio: use pm_runtime_resume_and_get() 2022-06-17 10:46:38 +02:00
xen xen/sndfront: use xenbus_setup_ring() and xenbus_teardown_ring() 2022-05-19 14:22:08 +02:00
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c