Skip to content

Commit 91502cb

Browse files
ujfalusilanlanxiyiji
authored andcommitted
ASoC: SOF: ipc4-topology: Harden loops for looking up ALH copiers
mainline inclusion from mainline-v6.14-rc4 category: bugfix CVE: CVE-2025-21870 Other, non DAI copier widgets could have the same stream name (sname) as the ALH copier and in that case the copier->data is NULL, no alh_data is attached, which could lead to NULL pointer dereference. We could check for this NULL pointer in sof_ipc4_prepare_copier_module() and avoid the crash, but a similar loop in sof_ipc4_widget_setup_comp_dai() will miscalculate the ALH device count, causing broken audio. The correct fix is to harden the matching logic by making sure that the 1. widget is a DAI widget - so dai = w->private is valid 2. the dai (and thus the copier) is ALH copier Fixes: a150345 ("ASoC: SOF: ipc4-topology: add SoundWire/ALH aggregation support") Reported-by: Seppo Ingalsuo <[email protected]> Link: thesofproject/sof#9652 Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Liam Girdwood <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Bard Liao <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> (cherry picked from commit 6fd6013) Conflicts: sound/soc/sof/ipc4-topology.c [Backport to linux-6.6.y, context changed because we not backport ("ASoC: SOF: ipc4-topology: Save the ALH DAI index during hw_params")] Signed-off-by: Wentao Guan <[email protected]>
1 parent ef85502 commit 91502cb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,16 @@ static int sof_ipc4_widget_setup_comp_dai(struct snd_sof_widget *swidget)
602602
}
603603

604604
list_for_each_entry(w, &sdev->widget_list, list) {
605-
if (w->widget->sname &&
605+
struct snd_sof_dai *alh_dai;
606+
607+
if (!WIDGET_IS_DAI(w->id) || !w->widget->sname ||
606608
strcmp(w->widget->sname, swidget->widget->sname))
607609
continue;
608610

611+
alh_dai = w->private;
612+
if (alh_dai->type != SOF_DAI_INTEL_ALH)
613+
continue;
614+
609615
blob->alh_cfg.device_count++;
610616
}
611617

@@ -1901,11 +1907,13 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
19011907
*/
19021908
i = 0;
19031909
list_for_each_entry(w, &sdev->widget_list, list) {
1904-
if (w->widget->sname &&
1910+
if (!WIDGET_IS_DAI(w->id) || !w->widget->sname ||
19051911
strcmp(w->widget->sname, swidget->widget->sname))
19061912
continue;
19071913

19081914
dai = w->private;
1915+
if (dai->type != SOF_DAI_INTEL_ALH)
1916+
continue;
19091917
alh_copier = (struct sof_ipc4_copier *)dai->private;
19101918
alh_data = &alh_copier->data;
19111919
blob->alh_cfg.mapping[i].device = alh_data->gtw_cfg.node_id;

0 commit comments

Comments
 (0)