kernel_optimize_test/include
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
..
acpi
asm-generic iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
clocksource
crypto
drm
dt-bindings ASoC: q6afe: dt-bindings: add q6afe clock bindings 2020-09-17 16:13:12 +01:00
keys
kunit
kvm
linux RISC-V Fixes for 5.9-rc2 2020-08-21 12:32:42 -07:00
math-emu
media
memory
misc
net ipv6: some fixes for ipv6_dev_find() 2020-08-18 15:58:53 -07:00
pcmcia
ras
rdma
scsi
soc
sound ASoC: hdac: make SOF HDA codec driver probe deterministic 2020-09-21 23:57:24 +01:00
target
trace Improvements to ext4's block allocator performance for very large file 2020-08-21 11:03:38 -07:00
uapi ASoC: SOF: Implement snd_sof_bytes_ext_volatile_get kcontrol IO 2020-09-08 13:55:00 +01:00
vdso
video
xen xen: branch for v5.9-rc1b 2020-08-14 13:34:37 -07:00