Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup
@ 2026-11-09  0:56 Baoli Zhang
  2026-11-09  7:13 ` Péter Ujfalusi
  2026-11-10 13:05 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Baoli Zhang @ 2026-11-09  0:56 UTC (permalink / raw)
  To: andriy.shevchenko, Liam Girdwood, Peter Ujfalusi, Bard Liao,
	Daniel Baluta, Kai Vehmanen, Pierre-Louis Bossart,
	Vijendar Mukunda, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Ranjani Sridharan,
	moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list
  Cc: Baoli Zhang, stable

sof_ipc4_widget_setup_comp_process() allocates the input and output pin
format arrays via sof_ipc4_get_audio_fmt(). When the following
sof_ipc4_widget_setup_msg() fails, e.g. because the firmware does not
provide a module matching the widget UUID, the error path jumps to the
'err' label, which frees the process struct and clears swidget->private
but skips sof_ipc4_free_audio_fmt(). The arrays are then unreachable and
are reported by kmemleak:

    sof_ipc4_get_audio_fmt+0xc9/0x420 [snd_sof]
    sof_ipc4_widget_setup_comp_process+0x8e/0x200 [snd_sof]
    snd_sof_load_topology+0x71a/0x840 [snd_sof]
    sof_pcm_probe+0x77/0x120 [snd_sof]
    snd_soc_component_probe+0x21/0x60 [snd_soc_core]
    ...

Jump to 'free_available_fmt' instead, as the other process widget error
paths after sof_ipc4_get_audio_fmt() already do.

The other IPC4 widget setup functions (pga, mixer, src, asrc) free the
audio formats in their common error label and are not affected.

Fixes: f9efae954905 ("ASoC: SOF: ipc4-topology: Add support for base config extension")
Cc: stable@vger.kernel.org
Signed-off-by: Baoli Zhang <baoli.zhang@linux.intel.com>
---
Changes in v2:
- Drop the Assisted-by tag.
- v1: https://lore.kernel.org/linux-sound/20261103021710.3647599-1-baoli.zhang@linux.intel.com/

 sound/soc/sof/ipc4-topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 8b13c97b34804..de03dc58021a1 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -1313,7 +1313,7 @@ static int sof_ipc4_widget_setup_comp_process(struct snd_sof_widget *swidget)
 
 	ret = sof_ipc4_widget_setup_msg(swidget, &process->msg);
 	if (ret)
-		goto err;
+		goto free_available_fmt;
 
 	/* parse process init module payload config type from module info */
 	fw_module = swidget->module_info;

base-commit: 3ecd14f81434da3b5ff5c44d243715f96d52303d
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup
  2026-11-09  0:56 [PATCH v2] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup Baoli Zhang
@ 2026-11-09  7:13 ` Péter Ujfalusi
  2026-11-10 13:05 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Péter Ujfalusi @ 2026-11-09  7:13 UTC (permalink / raw)
  To: Baoli Zhang, andriy.shevchenko, Liam Girdwood, Bard Liao,
	Daniel Baluta, Kai Vehmanen, Pierre-Louis Bossart,
	Vijendar Mukunda, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list
  Cc: stable



On 09/11/2026 02:56, Baoli Zhang wrote:
> sof_ipc4_widget_setup_comp_process() allocates the input and output pin
> format arrays via sof_ipc4_get_audio_fmt(). When the following
> sof_ipc4_widget_setup_msg() fails, e.g. because the firmware does not
> provide a module matching the widget UUID, the error path jumps to the
> 'err' label, which frees the process struct and clears swidget->private
> but skips sof_ipc4_free_audio_fmt(). The arrays are then unreachable and
> are reported by kmemleak:
> 
>     sof_ipc4_get_audio_fmt+0xc9/0x420 [snd_sof]
>     sof_ipc4_widget_setup_comp_process+0x8e/0x200 [snd_sof]
>     snd_sof_load_topology+0x71a/0x840 [snd_sof]
>     sof_pcm_probe+0x77/0x120 [snd_sof]
>     snd_soc_component_probe+0x21/0x60 [snd_soc_core]
>     ...
> 
> Jump to 'free_available_fmt' instead, as the other process widget error
> paths after sof_ipc4_get_audio_fmt() already do.
> 
> The other IPC4 widget setup functions (pga, mixer, src, asrc) free the
> audio formats in their common error label and are not affected.
> 
> Fixes: f9efae954905 ("ASoC: SOF: ipc4-topology: Add support for base config extension")
> Cc: stable@vger.kernel.org
> Signed-off-by: Baoli Zhang <baoli.zhang@linux.intel.com>

Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.linte.com>

> ---
> Changes in v2:
> - Drop the Assisted-by tag.
> - v1: https://lore.kernel.org/linux-sound/20261103021710.3647599-1-baoli.zhang@linux.intel.com/
> 
>  sound/soc/sof/ipc4-topology.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
> index 8b13c97b34804..de03dc58021a1 100644
> --- a/sound/soc/sof/ipc4-topology.c
> +++ b/sound/soc/sof/ipc4-topology.c
> @@ -1313,7 +1313,7 @@ static int sof_ipc4_widget_setup_comp_process(struct snd_sof_widget *swidget)
>  
>  	ret = sof_ipc4_widget_setup_msg(swidget, &process->msg);
>  	if (ret)
> -		goto err;
> +		goto free_available_fmt;
>  
>  	/* parse process init module payload config type from module info */
>  	fw_module = swidget->module_info;
> 
> base-commit: 3ecd14f81434da3b5ff5c44d243715f96d52303d

-- 
Péter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup
  2026-11-09  0:56 [PATCH v2] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup Baoli Zhang
  2026-11-09  7:13 ` Péter Ujfalusi
@ 2026-11-10 13:05 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-11-10 13:05 UTC (permalink / raw)
  To: andriy.shevchenko, Liam Girdwood, Peter Ujfalusi, Bard Liao,
	Daniel Baluta, Kai Vehmanen, Pierre-Louis Bossart,
	Vijendar Mukunda, Jaroslav Kysela, Takashi Iwai,
	Ranjani Sridharan, sound-open-firmware, linux-sound, linux-kernel,
	Baoli Zhang
  Cc: stable

On Mon, 09 Nov 2026 08:56:04 +0800, Baoli Zhang wrote:
> ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup

Applied to

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

Thanks!

[1/1] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup
      https://git.kernel.org/broonie/sound/c/e5c09fe3f9c8

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-10 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09  0:56 [PATCH v2] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup Baoli Zhang
2026-11-09  7:13 ` Péter Ujfalusi
2026-11-10 13:05 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox