Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
@ 2024-11-30 10:09 Dan Carpenter
  2024-11-30 11:23 ` Markus Elfring
  2024-12-02 18:51 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-11-30 10:09 UTC (permalink / raw)
  To: Ranjani Sridharan
  Cc: Liam Girdwood, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Kai Vehmanen, Pierre-Louis Bossart, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, sound-open-firmware, linux-sound, linux-kernel,
	kernel-janitors

These error paths should free comp_dai before returning.

Fixes: 909dadf21aae ("ASoC: SOF: topology: Make DAI widget parsing IPC agnostic")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 sound/soc/sof/ipc3-topology.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c
index c2fce554a674..e98b53b67d12 100644
--- a/sound/soc/sof/ipc3-topology.c
+++ b/sound/soc/sof/ipc3-topology.c
@@ -1588,14 +1588,14 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
 	ret = sof_update_ipc_object(scomp, comp_dai, SOF_DAI_TOKENS, swidget->tuples,
 				    swidget->num_tuples, sizeof(*comp_dai), 1);
 	if (ret < 0)
-		goto free;
+		goto free_comp;
 
 	/* update comp_tokens */
 	ret = sof_update_ipc_object(scomp, &comp_dai->config, SOF_COMP_TOKENS,
 				    swidget->tuples, swidget->num_tuples,
 				    sizeof(comp_dai->config), 1);
 	if (ret < 0)
-		goto free;
+		goto free_comp;
 
 	/* Subtract the base to match the FW dai index. */
 	if (comp_dai->type == SOF_DAI_INTEL_ALH) {
@@ -1603,7 +1603,8 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
 			dev_err(sdev->dev,
 				"Invalid ALH dai index %d, only Pin numbers >= %d can be used\n",
 				comp_dai->dai_index, INTEL_ALH_DAI_INDEX_BASE);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto free_comp;
 		}
 		comp_dai->dai_index -= INTEL_ALH_DAI_INDEX_BASE;
 	}
-- 
2.45.2


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

* Re: [PATCH] ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
  2024-11-30 10:09 [PATCH] ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai() Dan Carpenter
@ 2024-11-30 11:23 ` Markus Elfring
  2024-12-02 18:51 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2024-11-30 11:23 UTC (permalink / raw)
  To: Dan Carpenter, linux-sound, sound-open-firmware,
	Ranjani Sridharan
  Cc: kernel-janitors, LKML, Bard Liao, Daniel Baluta, Jaroslav Kysela,
	Kai Vehmanen, Liam Girdwood, Mark Brown, Peter Ujfalusi,
	Pierre-Louis Bossart, Takashi Iwai

> These error paths should free comp_dai before returning.

I hope that such a change description can become better.

Regards,
Markus

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

* Re: [PATCH] ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
  2024-11-30 10:09 [PATCH] ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai() Dan Carpenter
  2024-11-30 11:23 ` Markus Elfring
@ 2024-12-02 18:51 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2024-12-02 18:51 UTC (permalink / raw)
  To: Ranjani Sridharan, Dan Carpenter
  Cc: Liam Girdwood, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Kai Vehmanen, Pierre-Louis Bossart, Jaroslav Kysela, Takashi Iwai,
	sound-open-firmware, linux-sound, linux-kernel, kernel-janitors

On Sat, 30 Nov 2024 13:09:06 +0300, Dan Carpenter wrote:
> These error paths should free comp_dai before returning.
> 
> 

Applied to

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

Thanks!

[1/1] ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
      commit: 6d544ea21d367cbd9746ae882e67a839391a6594

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:[~2024-12-02 18:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-30 10:09 [PATCH] ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai() Dan Carpenter
2024-11-30 11:23 ` Markus Elfring
2024-12-02 18:51 ` Mark Brown

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