[PATCH 6.1.y 1/2] ASoC: SOF: avoid a NULL dereference with unsupported widgets
From: Artem Dinaburg
Date: Mon Sep 21 2026 - 15:38:19 EST
From: Guennadi Liakhovetski <guennadi.liakhovetski@xxxxxxxxxxxxxxx>
[ Upstream commit e3720f92e0237921da537e47a0b24e27899203f8 ]
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@xxxxxxxxxxxxxxx # 6.2
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@xxxxxxxxxxxxxxx>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20230329113828.28562-1-peter.ujfalusi@xxxxxxxxxxxxxxx
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
[ Backport to 6.1.y: although the upstream stable tag names 6.2, the
same module_info dereference is present here; the source change is
otherwise unchanged. ]
Assisted-by: LLM
Signed-off-by: Artem Dinaburg <artem@xxxxxxxxxxxxxxx>
---
Stable submission note: patch 1/2 in the CVE-2023-54233 series for Linux
6.1.y.
CVE: CVE-2023-54233
Build: This patch was included in the x86_64 allmodconfig and
CONFIG_WERROR=y build.
It produced vmlinux and 9,075 modules; the same four baseline objtool
notices appeared, with no new warnings or errors.
sound/soc/sof/ipc4-topology.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 49289932ba7e69..9540ba6ef659e6 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -1600,6 +1600,14 @@ static int sof_ipc4_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route *
int dst_queue = 0;
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;
+ }
+
dev_dbg(sdev->dev, "bind %s -> %s\n",
src_widget->widget->name, sink_widget->widget->name);
--
2.39.5