ASoC: SOF: Intel: hda-dai: Ensure DAI widget is valid during params
Subsystems (2)
PATCH 1/1 ASoC: SOF: Intel: hda-dai: Ensure DAI widget is valid during params
From: Bard Liao <[email protected]>
[ Upstream commit 569922b82ca660f8b24e705f6cf674e6b1f99cc7 ]
Each cpu DAI should associate with a widget. However, the topology might not create the right number of DAI widgets for aggregated amps. And it will cause NULL pointer deference.
Check that the DAI widget associated with the CPU DAI is valid to prevent NULL pointer deference due to missing DAI widgets in topologies with aggregated amps.
[ Backport to 6.6.y: Keep the NULL-widget checks in
sdw_hda_dai_hw_params() and sdw_params_stream(). Omit the extra check in the newer IPC4 CPU-DAI aggregation loop, which this target lacks. ]
---
Hi,
Please consider this backport of the fix for CVE-2024-58012 to 6.6.y.
The two NULL-widget guards are identical to upstream; the additional IPC4 CPU-DAI aggregation-loop guard is omitted because 6.6.y has no corresponding loop.
The complete fix is already present in 6.12.y, 6.18.y and 7.2.y.
Build-tested only as part of a cumulative 6.6.y series: x86_64 objects (allmodconfig, CONFIG_WERROR=y); no runtime testing.
Thanks,
Artem Dinaburg
sound/soc/sof/intel/hda-dai.c | 6 ++++++ sound/soc/sof/intel/hda.c | 5 +++++ 2 files changed, 11 insertions(+)
sound/soc/sof/intel/hda-dai.c +6 -0
@@ -454,6 +454,12 @@ int sdw_hda_dai_hw_params(struct snd_pcm_substream *substream,struct snd_sof_dev *sdev;int ret; +if (!w) { +dev_err (cpu_dai->dev,"%s widget not found, check amp link num in the topology\n" , + cpu_dai->name); +return -EINVAL ; + } + ret =non_hda_dai_hw_params (substream, params, cpu_dai);if (ret <0 ) {dev_err (cpu_dai->dev,"%s: non_hda_dai_hw_params failed %d\n" , __func__, ret);
sound/soc/sof/intel/hda.c +5 -0
@@ -102,6 +102,11 @@ static int sdw_params_stream(struct device *dev,struct snd_soc_dapm_widget *w =snd_soc_dai_get_widget (d, params_data->substream->stream);struct snd_sof_dai_config_data data = {0 }; +if (!w) { +dev_err (dev,"%s widget not found, check amp link num in the topology\n" , + d->name); +return -EINVAL ; + } data.dai_index = (params_data->link_id <<8 ) | d->id; data.dai_data = params_data->alh_stream_id;
Quoted 2 lines
Each cpu DAI should associate with a widget. However, the topology might not create the right number of DAI widgets for aggregated amps. And it
Queued for 6.6, thanks.
Signature · 2 lines
Thanks, Sasha