Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: wsa+renesas@sang-engineering.com, Frank.Li@kernel.org,
	imx@lists.linux.dev
Subject: Re: [PATCH 21/24] ASoC: renesas: msiof: Fix msiof_close() being skipped on rollback
Date: Thu, 08 Oct 2026 10:57:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-164068@kernel.org> (raw)
In-Reply-To: <20261008103831.542533-22-phucduc.bui@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] asoc: msiof: memory leak of prtd in msiof_open() error path
--

commit d7a4f2d9645c8240b2c60d42136e3b2e4694d703
Author: bui duc phuc <phucduc.bui@gmail.com>

ASoC: renesas: msiof: Fix msiof_close() being skipped on rollback

snd_pcm_hw_constraint_integer() may return 1, which is then returned from
msiof_open(). ASoC only marks the component as opened when .open() returns
0, so this patch explicitly returns 0 on success to ensure .close() isn't
skipped on rollback.

> diff --git a/sound/soc/renesas/rcar/msiof.c b/sound/soc/renesas/rcar/msiof.c
> index 128543fc4fc97..9fead9a22cdc4 100644
> --- a/sound/soc/renesas/rcar/msiof.c
> +++ b/sound/soc/renesas/rcar/msiof.c
> @@ -427,10 +427,12 @@ static int msiof_open(struct snd_soc_component *component,
>  	ret = snd_pcm_hw_constraint_integer(substream->runtime, SNDRV_PCM_HW_PARAM_PERIODS);
>  
>  open_err_dma:
> -	if (ret < 0)
> +	if (ret < 0) {
>  		dma_release_channel(chan);
> +		return ret;

[Severity: Medium]
Does this error path leak the dmaengine_pcm_runtime_data (prtd) memory?

In msiof_open(), if snd_dmaengine_pcm_open() succeeds, it allocates a prtd
object. If the subsequent call to snd_pcm_hw_constraint_integer() fails, the
function falls through to this open_err_dma error path.

Since this path calls dma_release_channel(chan) but fails to clean up the
PCM state via snd_dmaengine_pcm_close(substream) or
snd_dmaengine_pcm_close_release_chan(substream), is the prtd memory
permanently leaked when msiof_open() returns an error and the ASoC core
aborts the open sequence?

> +	}
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static int msiof_close(struct snd_soc_component *component,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261008103831.542533-1-phucduc.bui@gmail.com?part=21

  reply	other threads:[~2026-10-08 10:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 10:38 [PATCH 00/24] ASoC: Fix constraint return value handling phucduc.bui
2026-10-08 10:38 ` [PATCH 01/24] ASoC: amd: acp: Fix .close() being skipped on rollback phucduc.bui
2026-10-08 10:38 ` [PATCH 02/24] ASoC: amd: ps: Fix acp63_pdm_dma_close() " phucduc.bui
2026-10-08 10:38 ` [PATCH 03/24] ASoC: amd: ps: Fix acp63_sdw_dma_close() " phucduc.bui
2026-10-08 10:38 ` [PATCH 04/24] ASoC: amd: raven: Fix acp3x_dma_close() " phucduc.bui
2026-10-08 10:38 ` [PATCH 05/24] ASoC: amd: renoir: Fix acp_pdm_dma_close() " phucduc.bui
2026-10-08 10:38 ` [PATCH 06/24] ASoC: amd: vangogh: Fix acp5x_dma_close() " phucduc.bui
2026-10-08 10:54   ` sashiko-bot
2026-10-08 10:38 ` [PATCH 07/24] ASoC: amd: yc: Fix acp6x_pdm_dma_close() " phucduc.bui
2026-10-08 10:38 ` [PATCH 08/24] ASoC: apple: mca: Ensure the DAI is marked as started on success phucduc.bui
2026-10-08 10:38 ` [PATCH 09/24] ASoC: atmel: atmel-pcm-pdc: Fix atmel_pcm_close() being skipped on rollback phucduc.bui
2026-10-08 10:38 ` [PATCH 10/24] ASoC: codecs: cs42l42: Ensure the DAI is marked as started on success phucduc.bui
2026-10-08 10:47   ` Richard Fitzgerald
2026-10-08 11:00     ` Bui Duc Phuc
2026-10-08 10:38 ` [PATCH 11/24] ASoC: codecs: nau8325: " phucduc.bui
2026-10-08 10:38 ` [PATCH 12/24] ASoC: codecs: nau8540: " phucduc.bui
2026-10-08 10:38 ` [PATCH 13/24] ASoC: codecs: nau8821: " phucduc.bui
2026-10-08 10:38 ` [PATCH 14/24] ASoC: codecs: nau8824: " phucduc.bui
2026-10-08 10:38 ` [PATCH 15/24] ASoC: codecs: nau8825: " phucduc.bui
2026-10-08 10:38 ` [PATCH 16/24] ASoC: codecs: wm8580: " phucduc.bui
2026-10-08 10:38 ` [PATCH 17/24] ASoC: codecs: wm8782: " phucduc.bui
2026-10-08 10:38 ` [PATCH 18/24] ASoC: imx-pcm-rpmsg: Fix imx_rpmsg_pcm_close() being skipped on rollback phucduc.bui
2026-10-08 10:38 ` [PATCH 19/24] ASoC: intel: atom: Fix .shutdown() " phucduc.bui
2026-10-08 10:38 ` [PATCH 20/24] ASoC: renesas: fsi: Ensure the component is marked as opened on success phucduc.bui
2026-10-08 10:38 ` [PATCH 21/24] ASoC: renesas: msiof: Fix msiof_close() being skipped on rollback phucduc.bui
2026-10-08 10:57   ` sashiko-bot [this message]
2026-10-08 10:38 ` [PATCH 22/24] ASoC: renesas: rz-ssi: Ensure the component is marked as opened on success phucduc.bui
2026-10-08 10:38 ` [PATCH 23/24] ASoC: rockchip: rk3399_gru_sound: Mark the link as started " phucduc.bui
2026-10-08 10:38 ` [PATCH 24/24] ASoC: rockchip: rockchip_max98090: " phucduc.bui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-164068@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=phucduc.bui@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox