summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>2023-03-29 14:38:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-13 18:02:52 +0300
commit170818974e9732506195c6302743856cc8bdfd6f (patch)
treea4c027ee5cd799408568940158ae7998fcaae357 /sound/soc
parentea7c4392f086920b58bc296d6e701ba22e07c31c (diff)
downloadlinux-170818974e9732506195c6302743856cc8bdfd6f.tar.xz
ASoC: SOF: avoid a NULL dereference with unsupported widgets
commit e3720f92e0237921da537e47a0b24e27899203f8 upstream. 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: stable@vger.kernel.org # 6.2 Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230329113828.28562-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/sof/ipc4-topology.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 6da6137fa2cb..4f7adbe671f3 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -1686,6 +1686,14 @@ static int sof_ipc4_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route *
u32 header, extension;
int ret;
+ if (!src_fw_module || !sink_fw_module) {
+ /* The NULL module will print as "(efault)" */
+ dev_err(sdev->dev, "source %s or sink %s widget weren't set up properly\n",
+ src_fw_module->man4_module_entry.name,
+ sink_fw_module->man4_module_entry.name);
+ return -ENODEV;
+ }
+
sroute->src_queue_id = sof_ipc4_get_queue_id(src_widget, sink_widget,
SOF_PIN_TYPE_SOURCE);
if (sroute->src_queue_id < 0) {