Skip to content

Commit 2f78724

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: Fix possible null-ptr-deref when initing hw
Search result of avs_dai_find_path_template() shall be verified before being used. As 'template' is already known when avs_hw_constraints_init() is fired, drop the search entirely. Fixes: f2f8474 ("ASoC: Intel: avs: Constrain path based on BE capabilities") Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20250530141025.2942936-5-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 347c8d6 commit 2f78724

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

sound/soc/intel/avs/pcm.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ void avs_period_elapsed(struct snd_pcm_substream *substream)
8383
static int hw_rule_param_size(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule);
8484
static int avs_hw_constraints_init(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
8585
{
86-
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
8786
struct snd_pcm_runtime *runtime = substream->runtime;
8887
struct snd_pcm_hw_constraint_list *r, *c, *s;
89-
struct avs_tplg_path_template *template;
9088
struct avs_dma_data *data;
9189
int ret;
9290

@@ -99,8 +97,7 @@ static int avs_hw_constraints_init(struct snd_pcm_substream *substream, struct s
9997
c = &(data->channels_list);
10098
s = &(data->sample_bits_list);
10199

102-
template = avs_dai_find_path_template(dai, !rtd->dai_link->no_pcm, substream->stream);
103-
ret = avs_path_set_constraint(data->adev, template, r, c, s);
100+
ret = avs_path_set_constraint(data->adev, data->template, r, c, s);
104101
if (ret <= 0)
105102
return ret;
106103

0 commit comments

Comments
 (0)