From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable()
Date: Fri, 04 Dec 2026 11:52:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-249734@kernel.org> (raw)
In-Reply-To: <20261204111644.63432-8-phucduc.bui@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ASoC: amd: vangogh: substream UAF on unbind from
devm_request_irq() reorder
- [Low] ASoC: amd: vangogh: commit message omits probe reordering and
register write
--
commit 48a79efdbd97c6a6e821890453d8f2abe6c27bae
Author: bui duc phuc <phucduc.bui@gmail.com>
> ASoC: amd: vangogh: Use devm_pm_runtime_enable()
>
> Use devm_pm_runtime_enable() in the ACP5x PCM DMA driver to
> automatically disable runtime PM when the device is removed.
>
> This allows removing the remove callback.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
[Severity: Low]
Should the commit message also describe the other changes in
acp5x_audio_probe()? The patch reorders runtime PM, IRQ, and component
registration, adds a write to ACP_EXTERNAL_INTR_ENB, and drops the
dev_err() calls on failure.
Those changes are only listed below the --- separator, which is stripped
when applied, leaving the reason for reordering probe and restoring
ACP_EXTERNAL_INTR_ENB undocumented in git history.
> diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
> index 8b09e66610b52..c6a247efe8cfc 100644
> --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c
> +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
> @@ -400,30 +400,25 @@ static int acp5x_audio_probe(struct platform_device *pdev)
> adata->i2s_irq = status;
>
> dev_set_drvdata(&pdev->dev, adata);
> - status = devm_snd_soc_register_component(&pdev->dev,
> - &acp5x_i2s_component,
> - NULL, 0);
> - if (status) {
> - dev_err(&pdev->dev, "Fail to register acp i2s component\n");
> - return status;
> - }
> - status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
> - irqflags, "ACP5x_I2S_IRQ", adata);
> - if (status) {
> - dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n");
> - return status;
> - }
> +
> pm_runtime_set_autosuspend_delay(&pdev->dev, 2000);
> pm_runtime_use_autosuspend(&pdev->dev);
> pm_runtime_mark_last_busy(&pdev->dev);
> pm_runtime_set_active(&pdev->dev);
> - pm_runtime_enable(&pdev->dev);
> - return 0;
> -}
> + status = devm_pm_runtime_enable(&pdev->dev);
> + if (status)
> + return status;
>
> -static void acp5x_audio_remove(struct platform_device *pdev)
> -{
> - pm_runtime_disable(&pdev->dev);
> + status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
> + irqflags, "ACP5x_I2S_IRQ", adata);
> + if (status)
> + return status;
> +
> + acp_writel(1, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB);
> +
> + return devm_snd_soc_register_component(&pdev->dev,
> + &acp5x_i2s_component,
> + NULL, 0);
> }
[Severity: Medium]
Can moving devm_request_irq() ahead of devm_snd_soc_register_component()
cause a use-after-free of PCM substreams on device removal?
Because devres unwinds in LIFO order, devm_component_release() now runs
before devm_irq_release(). acp5x_i2s_component has no .sync_stop or
.remove callback, and acp5x_dma_close() clears the stream pointers without
locking or synchronize_irq(), so snd_card_free() frees the substreams
while i2s_irq_handler() is still active:
CPU0 CPU1
devres_release_all()
devm_component_release()
snd_soc_component_unregister()
...
i2s_irq_handler()
reads vg_i2s_data->play_stream
acp5x_dma_close()
adata->play_stream = NULL
snd_card_free()
kfree(substream)
snd_pcm_period_elapsed(play_stream)
<-- use-after-free
devm_irq_release()
free_irq()
Keeping devm_snd_soc_register_component() before devm_request_irq()
ensures free_irq() synchronizes and stops i2s_irq_handler() before the
component and its substreams are torn down.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204111644.63432-1-phucduc.bui@gmail.com?part=7
next prev parent reply other threads:[~2026-12-04 11:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 11:16 [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:16 ` [PATCH v2 1/9] ASoC: amd: ps: " phucduc.bui
2026-12-04 11:16 ` [PATCH v2 2/9] ASoC: amd: ps: Simplify component registration phucduc.bui
2026-12-04 11:16 ` [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:38 ` sashiko-bot
2026-12-04 11:52 ` Mukunda,Vijendar
2026-12-04 11:16 ` [PATCH v2 4/9] ASoC: amd: raven: Preserve probe error codes phucduc.bui
2026-12-04 11:16 ` [PATCH v2 5/9] ASoC: amd: renoir: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:45 ` sashiko-bot
2026-12-04 11:16 ` [PATCH v2 6/9] ASoC: amd: renoir: Preserve probe error codes phucduc.bui
2026-12-04 11:16 ` [PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable() phucduc.bui
2026-12-04 11:52 ` sashiko-bot [this message]
2026-12-04 11:16 ` [PATCH v2 8/9] ASoC: amd: yc: " phucduc.bui
2026-12-04 11:16 ` [PATCH v2 9/9] ASoC: amd: yc: Simplify component registration phucduc.bui
2026-12-04 12:46 ` [PATCH v2 0/9] ASoC: amd: Use devm_pm_runtime_enable() Syed Saba Kareem
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-249734@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=phucduc.bui@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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