From 114a6e63d9cc11311587773d5db4cf4105cf658f Mon Sep 17 00:00:00 2001 From: Julien Massot Date: Tue, 29 Apr 2025 11:19:22 +0200 Subject: [PATCH] ASoC: SOF: topology: Fix null pointer dereference The "get_function_tplg_files" function is only applicable to ACPI-based devices (sof_pdata->machine and not sof_pdata->of_machine). Skip this check for OF-based devices to avoid a NULL pointer dereference in snd_sof_load_topology(). Fixes: 6d5997c412cc ("ASoC: SOF: topology: load multiple topologies") Reviewed-by: Laurentiu Mihalcea Reviewed-by: Cristian Ciocaltea Signed-off-by: Julien Massot Reviewed-by: Daniel Baluta Link: https://patch.msgid.link/20250429-fixup-of-sof-topology-v4-1-ff692244d64c@collabora.com Signed-off-by: Mark Brown --- sound/soc/sof/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index e19ba94f2c80..5d3ee3a86392 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2481,7 +2481,7 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) if (!tplg_files) return -ENOMEM; - if (sof_pdata->machine->get_function_tplg_files) { + if (sof_pdata->machine && sof_pdata->machine->get_function_tplg_files) { tplg_cnt = sof_pdata->machine->get_function_tplg_files(scomp->card, sof_pdata->machine, tplg_filename_prefix, -- 2.50.1