diff mbox series

[6.10] ASoC: SOF: ipc4-topology: Fix input format query of process modules without base extension

Message ID 20240529121201.14687-1-peter.ujfalusi@linux.intel.com (mailing list archive)
State Accepted
Commit ffa077b2f6ad124ec3d23fbddc5e4b0ff2647af8
Headers show
Series [6.10] ASoC: SOF: ipc4-topology: Fix input format query of process modules without base extension | expand

Commit Message

Peter Ujfalusi May 29, 2024, 12:12 p.m. UTC
If a process module does not have base config extension then the same
format applies to all of it's inputs and the process->base_config_ext is
NULL, causing NULL dereference when specifically crafted topology and
sequences used.

Fixes: 648fea128476 ("ASoC: SOF: ipc4-topology: set copier output format for process module")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: stable@vger.kernel.org
---
Hi Mark,

Can you please pick this patch for 6.10 as it can fix a potential NULL
pointer dereference bug.

Thank you,
Peter

 sound/soc/sof/ipc4-topology.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Mark Brown May 29, 2024, 5:11 p.m. UTC | #1
On Wed, 29 May 2024 15:12:01 +0300, Peter Ujfalusi wrote:
> If a process module does not have base config extension then the same
> format applies to all of it's inputs and the process->base_config_ext is
> NULL, causing NULL dereference when specifically crafted topology and
> sequences used.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-topology: Fix input format query of process modules without base extension
      commit: ffa077b2f6ad124ec3d23fbddc5e4b0ff2647af8

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index beff10989324..33e8c5f7d9ca 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -217,6 +217,14 @@  sof_ipc4_get_input_pin_audio_fmt(struct snd_sof_widget *swidget, int pin_index)
 	}
 
 	process = swidget->private;
+
+	/*
+	 * For process modules without base config extension, base module config
+	 * format is used for all input pins
+	 */
+	if (process->init_config != SOF_IPC4_MODULE_INIT_CONFIG_TYPE_BASE_CFG_WITH_EXT)
+		return &process->base_config.audio_fmt;
+
 	base_cfg_ext = process->base_config_ext;
 
 	/*