From: sashiko-bot@kernel.org
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v1 5/7] ASoC: fsl_asrc: Replace dma_request_slave_channel() by dma_request_chan()
Date: Tue, 15 Sep 2026 10:25:12 +0000 [thread overview]
Message-ID: <20260915102513.1D7C01F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260915100931.3593242-6-andriy.shevchenko@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] sound: fsl_asrc: dma_release_channel() dereferences ERR_PTR in fsl_asrc_dma_hw_free
--
commit 6b21fbae024779272022d29e64403ad02a43c0a2
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: ASoC: fsl_asrc: Replace dma_request_slave_channel() by dma_request_chan()
This patch replaces the deprecated dma_request_slave_channel() API with
dma_request_chan() across the fsl_asrc driver.
> diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
> index 2f662bdf14d07..5cd12781c6042 100644
> --- a/sound/soc/fsl/fsl_asrc_dma.c
> +++ b/sound/soc/fsl/fsl_asrc_dma.c
> @@ -191,9 +191,10 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
> dma_params_fe->maxburst = dma_params_be->maxburst;
>
> pair->dma_chan[!dir] = asrc->get_dma_channel(pair, !dir);
> - if (!pair->dma_chan[!dir]) {
> + ret = PTR_ERR_OR_ZERO(pair->dma_chan[!dir]);
> + if (ret) {
> dev_err(dev, "failed to request DMA channel\n");
> - return -EINVAL;
> + return ret;
> }
[Severity: High]
Will this cause a panic in fsl_asrc_dma_hw_free() if get_dma_channel()
fails?
Since dma_request_chan() returns an ERR_PTR on failure, pair->dma_chan[!dir]
will now store an ERR_PTR instead of NULL when the DMA channel request fails.
If hw_params fails here, the ALSA PCM core handles the failure by invoking
the component's hw_free callback to clean up partially allocated resources.
That function checks if the channel pointer is truthy:
sound/soc/fsl/fsl_asrc_dma.c:fsl_asrc_dma_hw_free() {
...
if (pair->dma_chan[!dir])
dma_release_channel(pair->dma_chan[!dir]);
...
}
Since an ERR_PTR evaluates to true, dma_release_channel() is called with the
ERR_PTR, which will cause an invalid memory access and an immediate kernel
panic when it attempts to read chan->client_count.
Does fsl_asrc_dma_hw_free() need to be updated to use IS_ERR_OR_NULL()
instead, or should we reset pair->dma_chan[!dir] to NULL here on failure?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915100931.3593242-1-andriy.shevchenko@linux.intel.com?part=5
next prev parent reply other threads:[~2026-09-15 10:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 10:04 [PATCH v1 0/7] ASoC et alia: Convert to use dma_request_chan() Andy Shevchenko
2026-09-15 10:04 ` [PATCH v1 1/7] ASoC: stm32: spdifrx: Drop mention of the deprecated and unused call Andy Shevchenko
2026-09-15 10:04 ` [PATCH v1 2/7] ASoC: sprd: Replace dma_request_slave_channel() by dma_request_chan() Andy Shevchenko
2026-09-15 10:19 ` sashiko-bot
2026-09-15 14:04 ` Andy Shevchenko
2026-09-15 10:54 ` Baolin Wang
2026-09-15 17:35 ` Mark Brown
2026-09-15 10:04 ` [PATCH v1 3/7] ASoC: soc-generic-dmaengine-pcm: " Andy Shevchenko
2026-09-15 10:29 ` Cezary Rojewski
2026-09-15 10:04 ` [PATCH v1 4/7] ASoC: pxa: " Andy Shevchenko
2026-09-15 10:21 ` sashiko-bot
2026-09-15 14:09 ` Andy Shevchenko
2026-09-15 10:04 ` [PATCH v1 5/7] ASoC: fsl_asrc: " Andy Shevchenko
2026-09-15 10:25 ` sashiko-bot [this message]
2026-09-15 14:10 ` Andy Shevchenko
2026-09-15 14:02 ` Frank Li
2026-09-16 3:30 ` Shengjiu Wang
2026-09-15 10:04 ` [PATCH v1 6/7] gpib: fmh_gpib: " Andy Shevchenko
2026-09-15 10:21 ` sashiko-bot
2026-09-15 14:16 ` Andy Shevchenko
2026-09-15 14:16 ` Dave Penkler
2026-09-15 10:04 ` [PATCH v1 7/7] dmaengine: Remove deprecated dma_request_slave_channel() Andy Shevchenko
2026-09-15 14:03 ` Frank Li
2026-09-15 17:37 ` Vinod Koul
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=20260915102513.1D7C01F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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