linux/sound/soc/sof/intel
Kai Vehmanen 163cd1059a
ASoC: hdac: make SOF HDA codec driver probe deterministic
To provide backward compatibility to older systems, the SOF HDA driver
allows user to specify which HDMI codec driver to use at runtime via
kernel parameter. This mechanism has a subtle flaw in that it assumes
the codec drivers not to be loaded when the SOF PCI driver is loaded.

The problem is rooted in use of the hdev->type field.
snd_hdac_ext_bus_device_init() initializes this field to HDA_DEV_ASOC.
This signals the HDA core that ASoC drivers should be considered in
driver matching (hda_bus_match()). The SOF and SST drivers continue by
overriding this field to HDA_DEV_LEGACY and proceeding to load driver
modules with request_module(). Correct drivers will get loaded and
attached.

If however the codec drivers are already loaded when
snd_hdac_ext_bus_device_init() is called, the matching will not work as
expected as device type is still set to HDA_DEV_ASOC. Specifically if
hdac-hdmi is attached when machine driver is configured to use hdac-hda,
this leads to out-of-bounds memory access in
hda_dsp_hdmi_build_controls().

Fix the issue by adding codec type as a parameter to
snd_hdac_ext_bus_device_init() and ensuring type is set correctly from
the start.

Fixes: 139c7febad ("ASoC: SOF: Intel: add support for snd-hda-codec-hdmi")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921100841.2882662-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:57:24 +01:00
..
apl.c ASoC: SOF: Intel: remove the HDA_DSP_CORE_MASK() macro 2020-09-11 15:29:31 +01:00
bdw.c ASoC: SOF: rename cores_mask to host_managed_cores_mask 2020-09-11 15:29:29 +01:00
byt.c ASoC: SOF: rename cores_mask to host_managed_cores_mask 2020-09-11 15:29:29 +01:00
cnl.c ASoC: SOF: Intel: remove the HDA_DSP_CORE_MASK() macro 2020-09-11 15:29:31 +01:00
hda-bus.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-codec.c ASoC: hdac: make SOF HDA codec driver probe deterministic 2020-09-21 23:57:24 +01:00
hda-compress.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-ctrl.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-dai.c ASoC: sof: use asoc_substream_to_rtd() 2020-07-23 19:07:24 +01:00
hda-dsp.c ASoC: SOF: Intel: hda: modify core_power_up/down op 2020-09-11 15:29:30 +01:00
hda-ipc.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-ipc.h ASoC: SOF: Intel: hda: Add sof_tgl_ops for TGL platforms 2020-08-27 14:22:23 +01:00
hda-loader.c ASoC: SOF: Intel: hda: reduce verbosity of boot error logs 2020-09-17 15:53:21 +01:00
hda-pcm.c ASoC: sof: use asoc_substream_to_rtd() 2020-07-23 19:07:24 +01:00
hda-stream.c ASoC: SOF: Intel: hda: Add helper function to program ICCMAX stream 2020-08-27 14:22:19 +01:00
hda-trace.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda.c ASoC: SOF: Intel: hda: reduce verbosity of boot error logs 2020-09-17 15:53:21 +01:00
hda.h Merge series "ASoC: SOF: small fixes for 5.10" from Kai Vehmanen <kai.vehmanen@linux.intel.com>: 2020-09-17 17:40:15 +01:00
intel-ipc.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
Kconfig ASoC: Intel: use consistent HDAudio spelling in comments/docs 2020-08-25 20:39:39 +01:00
Makefile ASoC: SOF: Intel: hda: Add sof_tgl_ops for TGL platforms 2020-08-27 14:22:23 +01:00
shim.h ASoC: SOF: rename cores_mask to host_managed_cores_mask 2020-09-11 15:29:29 +01:00
tgl.c ASoC: SOF: Intel: Add support for tgl-h 2020-09-17 17:40:09 +01:00