Skip to content

Commit e3720f9

Browse files
lyakhbroonie
authored andcommitted
ASoC: SOF: avoid a NULL dereference with unsupported widgets
If an IPC4 topology contains an unsupported widget, its .module_info field won't be set, then sof_ipc4_route_setup() will cause a kernel Oops trying to dereference it. Add a check for such cases. Cc: [email protected] # 6.2 Signed-off-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 44378cd commit e3720f9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,14 @@ static int sof_ipc4_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route *
18051805
u32 header, extension;
18061806
int ret;
18071807

1808+
if (!src_fw_module || !sink_fw_module) {
1809+
/* The NULL module will print as "(efault)" */
1810+
dev_err(sdev->dev, "source %s or sink %s widget weren't set up properly\n",
1811+
src_fw_module->man4_module_entry.name,
1812+
sink_fw_module->man4_module_entry.name);
1813+
return -ENODEV;
1814+
}
1815+
18081816
sroute->src_queue_id = sof_ipc4_get_queue_id(src_widget, sink_widget,
18091817
SOF_PIN_TYPE_SOURCE);
18101818
if (sroute->src_queue_id < 0) {

0 commit comments

Comments
 (0)