From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: Frank.Li@kernel.org, vkoul@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v1 2/7] ASoC: sprd: Replace dma_request_slave_channel() by dma_request_chan()
Date: Tue, 15 Sep 2026 17:04:44 +0300 [thread overview]
Message-ID: <aqlQfDz1YFN_C0cu@ashevche-desk.local> (raw)
In-Reply-To: <20260915101925.1CF461F000FF@smtp.kernel.org>
On Tue, Sep 15, 2026 at 10:19:24AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] ASoC: sprd: crash in dma_release_channel() due to ERR_PTR leak
> --
>
> commit 5e4c398ebe4c03b68c30e555198977e4ad4905e4
> Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> ASoC: sprd: Replace dma_request_slave_channel() by dma_request_chan()
>
> This commit replaces deprecated dma_request_slave_channel calls with
> dma_request_chan. It updates the error checking from NULL checks to
> IS_ERR.
>
> > diff --git a/sound/soc/sprd/sprd-pcm-compress.c b/sound/soc/sprd/sprd-pcm-compress.c
> > index e5249924b54d9..5613c25fffd73 100644
> > --- a/sound/soc/sprd/sprd-pcm-compress.c
> > +++ b/sound/soc/sprd/sprd-pcm-compress.c
> > @@ -153,11 +153,10 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
> > return -EINVAL;
> > }
> >
> > - dma->chan = dma_request_slave_channel(dev,
> > - dma_params->chan_name[channel]);
> > - if (!dma->chan) {
> > + dma->chan = dma_request_chan(dev, dma_params->chan_name[channel]);
> > + if (IS_ERR(dma->chan)) {
>
> [Severity: High]
> If dma_request_chan fails, does this leak the error pointer into the compress
> stream's persistent dma array?
>
> When the file descriptor is closed or cleaned up, the free path in
> sprd_platform_compr_free() will attempt to release the channel:
>
> if (dma->chan) {
> dma_release_channel(dma->chan);
> dma->chan = NULL;
> }
>
> Since the error path doesn't clear the error pointer from dma->chan, the if
> check evaluates to true. Will dma_release_channel() then dereference the error
> pointer and crash?
> > dev_err(dev, "failed to request dma channel\n");
> > - return -ENODEV;
> > + return PTR_ERR(dma->chan);
> > }
Granted, I will add an amendment to dma_release_chan() to be NULL and ERR_PTR
aware.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-09-15 14:04 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 [this message]
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
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=aqlQfDz1YFN_C0cu@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=Frank.Li@kernel.org \
--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