2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-10 22:54:11 +08:00
linux-next/sound/soc/intel/skylake
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
..
bxt-sst.c ASoC: Intel: Skylake: Await purge request ack on CNL 2020-03-10 17:44:29 +00:00
cnl-sst-dsp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 490 2019-06-19 17:09:52 +02:00
cnl-sst-dsp.h ASoC: Intel: Skylake: (cosmetic) align function parameters 2020-08-18 11:50:26 +01:00
cnl-sst.c ASoC: Intel: Skylake: Await purge request ack on CNL 2020-03-10 17:44:29 +00:00
Makefile ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
skl-debug.c ASoC: intel: skl: Fix possible buffer overflow in debug outputs 2020-02-19 13:36:15 +00:00
skl-i2s.h ASoC: Intel: Skylake: Replace zero-length array with flexible-array 2020-05-12 17:14:33 +01:00
skl-messages.c ASoC: Intel: Skylake: Print module type instead of id 2019-08-27 19:26:06 +01:00
skl-nhlt.c ASoC: Intel: Skylake: skl-nhlt: remove redundant initialization 2020-08-18 11:50:21 +01:00
skl-pcm.c ASoC: Intel: drop unnecessary list_empty 2020-07-30 22:38:39 +01:00
skl-ssp-clk.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
skl-ssp-clk.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
skl-sst-cldma.c ASoC: Intel: Skylake: cldma: remove redundant initialization 2020-08-18 11:50:22 +01:00
skl-sst-cldma.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 490 2019-06-19 17:09:52 +02:00
skl-sst-dsp.c ASoC: Intel: Skylake: Merge skl_sst and skl into skl_dev struct 2019-07-24 19:41:33 +01:00
skl-sst-dsp.h ASoC: Intel: Skylake: Await purge request ack on CNL 2020-03-10 17:44:29 +00:00
skl-sst-ipc.c ASoC: Intel: Skylake: large_config_get overhaul 2019-08-08 21:22:33 +01:00
skl-sst-ipc.h ASoC: Intel: Skylake: (cosmetic) align function parameters 2020-08-18 11:50:26 +01:00
skl-sst-utils.c ASoC: Intel: Skylake: sst-utils: remove redundant assignment 2020-08-18 11:50:23 +01:00
skl-sst.c ASoC: various vendors: delete repeated words in comments 2020-08-18 14:52:32 +01:00
skl-topology.c ASoC: Intel: Skylake: skl-topology: remove redundant assignment 2020-08-18 11:50:25 +01:00
skl-topology.h ASoC: Intel: Skylake: (cosmetic) align function parameters 2020-08-18 11:50:26 +01:00
skl.c ASoC: hdac: make SOF HDA codec driver probe deterministic 2020-09-21 23:57:24 +01:00
skl.h ASoC: Intel: Skylake: (cosmetic) align function parameters 2020-08-18 11:50:26 +01:00