[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250428161236.126200-1-laurentiumihalcea111@gmail.com>
Date: Mon, 28 Apr 2025 12:12:36 -0400
From: Laurentiu Mihalcea <laurentiumihalcea111@...il.com>
To: Liam Girdwood <lgirdwood@...il.com>,
Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Daniel Baluta <daniel.baluta@....com>,
Mark Brown <broonie@...nel.org>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.dev>
Cc: linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ASoC: SOF: topology: check if machine is NULL during tplg load
From: Laurentiu Mihalcea <laurentiu.mihalcea@....com>
Check if "sof_pdata->machine" is NULL before calling the machine-specific
"get_function_tplg_files()". Otherwise, for OF-based machines (which set
the "of_machine" instead of the "machine" field), the operation will
result in a NULL pointer dereference fault.
Fixes: 6d5997c412cc ("ASoC: SOF: topology: load multiple topologies")
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@....com>
---
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.34.1
Powered by blists - more mailing lists