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: imx@lists.linux.dev, Frank.Li@kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v2 19/25] ASoC: intel: atom: Fix .shutdown() being skipped on rollback
Date: Fri, 16 Oct 2026 04:12:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-173739@kernel.org> (raw)
In-Reply-To: <20261015014324.5569-20-phucduc.bui@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ALSA: intel: atom: resource leak on sst_media_open() error path
--

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

ASoC: intel: atom: Fix .shutdown() being skipped on rollback

snd_pcm_hw_constraint_integer() may return 1, which is then returned
from sst_media_open(). ASoC only marks the DAI as started when
.startup() returns 0, so .shutdown() can be skipped on rollback.
This commit returns 0 explicitly on success.

> diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> index a4c8cbfba0963..58681e007abf9 100644
> --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> @@ -341,7 +341,12 @@ static int sst_media_open(struct snd_pcm_substream *substream,
>  
>  	stream = NULL;
>  
> -	return ret_val;
> +	/*
> +	 * ASoC only marks the DAI as started when .startup() returns 0.
> +	 * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
> +	 * return 0 to ensure .shutdown() is not skipped on rollback.
> +	 */
> +	return 0;
>  }

[Severity: High]
Since ASoC only marks the DAI as started when .startup() returns 0, do the
error paths earlier in sst_media_open() leak resources?

For example, if power_up_sst() fails:

	ret_val = power_up_sst(stream);
	if (ret_val < 0)
		return ret_val;

The function returns the error directly. Since .startup() returns an error,
.shutdown() won't be called. Does this leak the module reference acquired
earlier via try_module_get(sst->dev->driver->owner)?

Similarly, if snd_pcm_hw_constraint_integer() fails:

	ret_val = snd_pcm_hw_constraint_integer(runtime,
						SNDRV_PCM_HW_PARAM_PERIODS);

	if (ret_val < 0)
		return ret_val;

The function returns the error, skipping .shutdown(). Does this leak both
the module reference and the power state from power_up_sst(stream)?

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

  parent reply	other threads:[~2026-10-16  4:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  1:42 [PATCH v2 00/25] ASoC: Fix constraint return value handling phucduc.bui
2026-10-15  1:43 ` [PATCH v2 01/25] ASoC: amd: acp: Fix .close() being skipped on rollback phucduc.bui
2026-10-16  4:19   ` sashiko-bot
2026-10-16  7:40     ` Bui Duc Phuc
2026-10-15  1:43 ` [PATCH v2 02/25] ASoC: amd: ps: Fix acp63_pdm_dma_close() " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 03/25] ASoC: amd: ps: Fix acp63_sdw_dma_close() " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 04/25] ASoC: amd: raven: Fix acp3x_dma_close() " phucduc.bui
2026-10-16  4:14   ` sashiko-bot
2026-10-15  1:43 ` [PATCH v2 05/25] ASoC: amd: renoir: Fix acp_pdm_dma_close() " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 06/25] ASoC: amd: vangogh: Fix acp5x_dma_close() " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 07/25] ASoC: amd: yc: Fix acp6x_pdm_dma_close() " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 08/25] ASoC: apple: mca: Ensure the DAI is marked as started on success phucduc.bui
2026-10-15  1:43 ` [PATCH v2 09/25] ASoC: atmel: atmel-pcm-pdc: Fix atmel_pcm_close() being skipped on rollback phucduc.bui
2026-10-16  4:16   ` sashiko-bot
2026-10-15  1:43 ` [PATCH v2 10/25] ASoC: codecs: cs42l42: Ensure the DAI is marked as started on success phucduc.bui
2026-10-15  1:43 ` [PATCH v2 11/25] ASoC: codecs: nau8325: " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 12/25] ASoC: codecs: nau8540: " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 13/25] ASoC: codecs: nau8821: " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 14/25] ASoC: codecs: nau8824: " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 15/25] ASoC: codecs: nau8825: " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 16/25] ASoC: codecs: wm8580: " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 17/25] ASoC: codecs: wm8782: " phucduc.bui
2026-10-15  1:43 ` [PATCH v2 18/25] ASoC: imx-pcm-rpmsg: Fix imx_rpmsg_pcm_close() being skipped on rollback phucduc.bui
2026-10-16  4:14   ` sashiko-bot
2026-10-15  1:43 ` [PATCH v2 19/25] ASoC: intel: atom: Fix .shutdown() " phucduc.bui
2026-10-15 10:44   ` Cezary Rojewski
2026-10-16  4:12   ` sashiko-bot [this message]
2026-10-15  1:43 ` [PATCH v2 20/25] ASoC: renesas: fsi: Ensure the component is marked as opened on success phucduc.bui
2026-10-15  3:55   ` Kuninori Morimoto
2026-10-15  1:43 ` [PATCH v2 21/25] ASoC: renesas: msiof: Remove redundant period constraint phucduc.bui
2026-10-15  3:56   ` Kuninori Morimoto
2026-10-15  1:43 ` [PATCH v2 22/25] ASoC: renesas: rz-ssi: Ensure the component is marked as opened on success phucduc.bui
2026-10-15  1:43 ` [PATCH v2 23/25] ASoC: renesas: rz-ssi: Remove redundant component open callback phucduc.bui
2026-10-15  1:43 ` [PATCH v2 24/25] ASoC: rockchip: rk3399_gru_sound: Mark the link as started on success phucduc.bui
2026-10-15 11:12 ` [PATCH v2 00/25] ASoC: Fix constraint return value handling Mark Brown
2026-10-16  1:52   ` Bui Duc Phuc
2026-10-16  4:00 ` [PATCH v2 25/25] ASoC: rockchip: rockchip_max98090: Mark the link as started on success phucduc.bui
2026-10-16 10:27   ` Mark Brown
2026-10-16 11:25     ` Bui Duc Phuc

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-173739@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