提交 fe4d4f2c 编写于 作者: P Pierre-Louis Bossart 提交者: Xie XiuQi

ASoC: dapm: fix out-of-bounds accesses to DAPM lookup tables

[ Upstream commit c16e12010060c6c7a31f08b4a99513064cb53b7d ]

KASAN reports and additional traces point to out-of-bounds accesses to
the dapm_up_seq and dapm_down_seq lookup tables. The indices used are
larger than the array definition.

Fix by adding missing entries for the new widget types in these two
lookup tables, and align them with PGA values.

Also the sequences for the following widgets were not defined. Since
their values defaulted to zero, assign them explicitly

 snd_soc_dapm_input
 snd_soc_dapm_output
 snd_soc_dapm_vmid
 snd_soc_dapm_siggen
 snd_soc_dapm_sink

Fixes: 8a70b454 ('ASoC: dapm: Add new widget type for constructing DAPM graphs on DSPs.').
Signed-off-by: NPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 9e76b1b5
...@@ -71,12 +71,16 @@ static int dapm_up_seq[] = { ...@@ -71,12 +71,16 @@ static int dapm_up_seq[] = {
[snd_soc_dapm_clock_supply] = 1, [snd_soc_dapm_clock_supply] = 1,
[snd_soc_dapm_supply] = 2, [snd_soc_dapm_supply] = 2,
[snd_soc_dapm_micbias] = 3, [snd_soc_dapm_micbias] = 3,
[snd_soc_dapm_vmid] = 3,
[snd_soc_dapm_dai_link] = 2, [snd_soc_dapm_dai_link] = 2,
[snd_soc_dapm_dai_in] = 4, [snd_soc_dapm_dai_in] = 4,
[snd_soc_dapm_dai_out] = 4, [snd_soc_dapm_dai_out] = 4,
[snd_soc_dapm_aif_in] = 4, [snd_soc_dapm_aif_in] = 4,
[snd_soc_dapm_aif_out] = 4, [snd_soc_dapm_aif_out] = 4,
[snd_soc_dapm_mic] = 5, [snd_soc_dapm_mic] = 5,
[snd_soc_dapm_siggen] = 5,
[snd_soc_dapm_input] = 5,
[snd_soc_dapm_output] = 5,
[snd_soc_dapm_mux] = 6, [snd_soc_dapm_mux] = 6,
[snd_soc_dapm_demux] = 6, [snd_soc_dapm_demux] = 6,
[snd_soc_dapm_dac] = 7, [snd_soc_dapm_dac] = 7,
...@@ -84,11 +88,19 @@ static int dapm_up_seq[] = { ...@@ -84,11 +88,19 @@ static int dapm_up_seq[] = {
[snd_soc_dapm_mixer] = 8, [snd_soc_dapm_mixer] = 8,
[snd_soc_dapm_mixer_named_ctl] = 8, [snd_soc_dapm_mixer_named_ctl] = 8,
[snd_soc_dapm_pga] = 9, [snd_soc_dapm_pga] = 9,
[snd_soc_dapm_buffer] = 9,
[snd_soc_dapm_scheduler] = 9,
[snd_soc_dapm_effect] = 9,
[snd_soc_dapm_src] = 9,
[snd_soc_dapm_asrc] = 9,
[snd_soc_dapm_encoder] = 9,
[snd_soc_dapm_decoder] = 9,
[snd_soc_dapm_adc] = 10, [snd_soc_dapm_adc] = 10,
[snd_soc_dapm_out_drv] = 11, [snd_soc_dapm_out_drv] = 11,
[snd_soc_dapm_hp] = 11, [snd_soc_dapm_hp] = 11,
[snd_soc_dapm_spk] = 11, [snd_soc_dapm_spk] = 11,
[snd_soc_dapm_line] = 11, [snd_soc_dapm_line] = 11,
[snd_soc_dapm_sink] = 11,
[snd_soc_dapm_kcontrol] = 12, [snd_soc_dapm_kcontrol] = 12,
[snd_soc_dapm_post] = 13, [snd_soc_dapm_post] = 13,
}; };
...@@ -101,13 +113,25 @@ static int dapm_down_seq[] = { ...@@ -101,13 +113,25 @@ static int dapm_down_seq[] = {
[snd_soc_dapm_spk] = 3, [snd_soc_dapm_spk] = 3,
[snd_soc_dapm_line] = 3, [snd_soc_dapm_line] = 3,
[snd_soc_dapm_out_drv] = 3, [snd_soc_dapm_out_drv] = 3,
[snd_soc_dapm_sink] = 3,
[snd_soc_dapm_pga] = 4, [snd_soc_dapm_pga] = 4,
[snd_soc_dapm_buffer] = 4,
[snd_soc_dapm_scheduler] = 4,
[snd_soc_dapm_effect] = 4,
[snd_soc_dapm_src] = 4,
[snd_soc_dapm_asrc] = 4,
[snd_soc_dapm_encoder] = 4,
[snd_soc_dapm_decoder] = 4,
[snd_soc_dapm_switch] = 5, [snd_soc_dapm_switch] = 5,
[snd_soc_dapm_mixer_named_ctl] = 5, [snd_soc_dapm_mixer_named_ctl] = 5,
[snd_soc_dapm_mixer] = 5, [snd_soc_dapm_mixer] = 5,
[snd_soc_dapm_dac] = 6, [snd_soc_dapm_dac] = 6,
[snd_soc_dapm_mic] = 7, [snd_soc_dapm_mic] = 7,
[snd_soc_dapm_siggen] = 7,
[snd_soc_dapm_input] = 7,
[snd_soc_dapm_output] = 7,
[snd_soc_dapm_micbias] = 8, [snd_soc_dapm_micbias] = 8,
[snd_soc_dapm_vmid] = 8,
[snd_soc_dapm_mux] = 9, [snd_soc_dapm_mux] = 9,
[snd_soc_dapm_demux] = 9, [snd_soc_dapm_demux] = 9,
[snd_soc_dapm_aif_in] = 10, [snd_soc_dapm_aif_in] = 10,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册