From: sashiko-bot@kernel.org
To: "Ruizhe Zhou" <zhouruizhe@resnics.com>
Cc: dmaengine@vger.kernel.org, Frank.Li@kernel.org, vkoul@kernel.org
Subject: Re: [PATCH 3/3] dmaengine: sprd: Remove obsolete 32-bit DMA mask fallback
Date: Thu, 03 Sep 2026 14:26:52 +0000 [thread overview]
Message-ID: <20260903142653.52D9D1F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260903115441.912500-4-zhouruizhe@resnics.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Premature IRQ request leading to potential NULL pointer dereference and uninitialized spinlock access.
- [Medium] PM runtime usage counter and enabled state leak on the `pm_runtime_get_sync()` error path.
--
commit 323a1a8d4f9b18f09fa8dd3e9872da5d0d05321b
Author: Ruizhe Zhou <zhouruizhe@resnics.com>
dmaengine: sprd: Remove obsolete 32-bit DMA mask fallback
This commit removes the obsolete 32-bit DMA mask fallback from
sprd_dma_probe(), relying solely on the 36-bit DMA mask request, while
retaining the error check to report genuine DMA setup failures.
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 087fea3af2e41..b9f705dd80e52 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -1117,11 +1117,8 @@ static int sprd_dma_probe(struct platform_device *pdev)
>
> ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
> if (ret) {
> - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> - if (ret) {
> - dev_err(&pdev->dev, "unable to set coherent mask to 32\n");
> - return ret;
> - }
> + dev_err(&pdev->dev, "unable to set 36-bit DMA mask\n");
> + return ret;
> }
>
> /* Parse new and deprecated dma-channels properties */
[Severity: High]
This isn't a bug introduced by this patch, but looking further down in
sprd_dma_probe(), could the premature IRQ request lead to a NULL pointer
dereference or uninitialized spinlock access if an interrupt fires immediately?
If an interrupt is pending at the controller level, the handler dma_irq_handle()
will execute as soon as it is requested:
ret = devm_request_irq(&pdev->dev, sdev->irq, dma_irq_handle,
0, "sprd_dma", (void *)sdev);
The interrupt handler will then dereference sdev->glb_base, which is mapped
later:
sdev->glb_base = devm_platform_ioremap_resource(pdev, 0);
And it will attempt to acquire the spinlock, which is initialized even later:
vchan_init(&dma_chn->vc, &sdev->dma_dev);
[Severity: Medium]
This is a pre-existing issue, but does the pm_runtime_get_sync() error path
leak the PM runtime usage counter and leave PM runtime enabled?
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0)
goto err_rpm;
If pm_runtime_get_sync() fails and returns a negative error code, it jumps
to the err_rpm label:
err_rpm:
sprd_dma_disable(sdev);
return ret;
Since pm_runtime_get_sync() increments the usage counter even on failure,
shouldn't this path call pm_runtime_put_noidle() to drop the usage counter,
and balance the earlier pm_runtime_enable() call with pm_runtime_disable()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903115441.912500-1-zhouruizhe@resnics.com?part=3
prev parent reply other threads:[~2026-09-03 14:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 11:54 [PATCH 0/3] dmaengine: Remove obsolete 32-bit DMA mask fallbacks Ruizhe Zhou
2026-09-03 11:54 ` [PATCH 1/3] dmaengine: ptdma: Remove obsolete 32-bit DMA mask fallback Ruizhe Zhou
2026-09-03 19:26 ` Frank Li
2026-09-04 11:15 ` 周睿哲
2026-09-03 11:54 ` [PATCH 2/3] dmaengine: plx_dma: " Ruizhe Zhou
2026-09-03 14:29 ` sashiko-bot
2026-09-03 22:00 ` Logan Gunthorpe
2026-09-03 11:54 ` [PATCH 3/3] dmaengine: sprd: " Ruizhe Zhou
2026-09-03 14:26 ` sashiko-bot [this message]
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=20260903142653.52D9D1F00AC4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=zhouruizhe@resnics.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