* [PATCH] ASoC: SOF: topology: check if machine is NULL during tplg load
@ 2025-04-28 16:12 Laurentiu Mihalcea
2025-04-28 16:50 ` Daniel Baluta
0 siblings, 1 reply; 3+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-28 16:12 UTC (permalink / raw)
To: Liam Girdwood, Peter Ujfalusi, Bard Liao, Ranjani Sridharan,
Daniel Baluta, Mark Brown, Kai Vehmanen, Pierre-Louis Bossart
Cc: linux-sound, linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.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@nxp.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SOF: topology: check if machine is NULL during tplg load
2025-04-28 16:12 [PATCH] ASoC: SOF: topology: check if machine is NULL during tplg load Laurentiu Mihalcea
@ 2025-04-28 16:50 ` Daniel Baluta
2025-04-28 19:11 ` Laurentiu Mihalcea
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Baluta @ 2025-04-28 16:50 UTC (permalink / raw)
To: Laurentiu Mihalcea, julien.massot
Cc: Liam Girdwood, Peter Ujfalusi, Bard Liao, Ranjani Sridharan,
Daniel Baluta, Mark Brown, Kai Vehmanen, Pierre-Louis Bossart,
linux-sound, linux-kernel
On Mon, Apr 28, 2025 at 7:16 PM Laurentiu Mihalcea
<laurentiumihalcea111@gmail.com> wrote:
>
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.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@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
I think same patch was sent by Julien, but this one has better explanation.
Julien, I think you can add your S-o-B tag here.
Thanks,
Daniel.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SOF: topology: check if machine is NULL during tplg load
2025-04-28 16:50 ` Daniel Baluta
@ 2025-04-28 19:11 ` Laurentiu Mihalcea
0 siblings, 0 replies; 3+ messages in thread
From: Laurentiu Mihalcea @ 2025-04-28 19:11 UTC (permalink / raw)
To: Daniel Baluta, julien.massot
Cc: Liam Girdwood, Peter Ujfalusi, Bard Liao, Ranjani Sridharan,
Daniel Baluta, Mark Brown, Kai Vehmanen, Pierre-Louis Bossart,
linux-sound, linux-kernel
On 4/28/2025 7:50 PM, Daniel Baluta wrote:
> On Mon, Apr 28, 2025 at 7:16 PM Laurentiu Mihalcea
> <laurentiumihalcea111@gmail.com> wrote:
>> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.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@nxp.com>
> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
>
> I think same patch was sent by Julien, but this one has better explanation.
>
> Julien, I think you can add your S-o-B tag here.
>
> Thanks,
> Daniel.
sorry for the noise, somehow I missed Julien's patch. Dropping this in favor of
his.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-28 19:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28 16:12 [PATCH] ASoC: SOF: topology: check if machine is NULL during tplg load Laurentiu Mihalcea
2025-04-28 16:50 ` Daniel Baluta
2025-04-28 19:11 ` Laurentiu Mihalcea
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox