From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v2 3/9] ASoC: amd: raven: Use devm_pm_runtime_enable()
Date: Fri, 04 Dec 2026 11:38:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-249698@kernel.org> (raw)
In-Reply-To: <20261204111644.63432-4-phucduc.bui@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ASoC: amd: raven: UAF in i2s_irq_handler() due to
probe/devres reordering
- [Low] ASoC: amd: raven: commit message omits probe reordering and MMIO
write
--
commit bfce84f5994b14173f5fe0980ac3f19b7b299695
Author: bui duc phuc <phucduc.bui@gmail.com>
> ASoC: amd: raven: Use devm_pm_runtime_enable()
>
> Use devm_pm_runtime_enable() to automatically disable runtime PM
> when the device is removed, allowing the remove callback to be
> removed.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
[Severity: Low]
Should the commit message also describe the probe reordering and the new
mmACP_EXTERNAL_INTR_ENB write?
The patch moves runtime PM setup and devm_request_irq() ahead of
devm_snd_soc_register_component(), and adds a write to
mmACP_EXTERNAL_INTR_ENB in acp3x_audio_probe(). These are only noted
after the --- separator, which is stripped when the patch is applied.
> diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
> index 700c0ca20e181..1555157d8316c 100644
> --- a/sound/soc/amd/raven/acp3x-pcm-dma.c
> +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
> @@ -408,6 +408,24 @@ static int acp3x_audio_probe(struct platform_device *pdev)
> adata->i2s_irq = status;
>
> dev_set_drvdata(&pdev->dev, adata);
> +
> + 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);
> + status = devm_pm_runtime_enable(&pdev->dev);
> + if (status)
> + return status;
> +
> + status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler,
> + irqflags, "ACP3x_I2S_IRQ", adata);
> + if (status) {
> + dev_err(&pdev->dev, "ACP3x I2S IRQ request failed\n");
> + return -ENODEV;
> + }
> +
> + rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
> +
> status = devm_snd_soc_register_component(&pdev->dev,
> &acp3x_i2s_component,
> NULL, 0);
[Severity: Medium]
Can moving devm_request_irq() before devm_snd_soc_register_component()
cause a use-after-free of struct snd_pcm_substream during driver unbind?
Devres unwinds in LIFO order, so devm_component_release() now runs before
devm_irq_release() calls free_irq(). acp3x_dma_close() clears the stream
pointers without locking or calling synchronize_irq(), leaving an
in-flight i2s_irq_handler() with a stale substream pointer:
CPU0 CPU1
devres_release_all()
devm_component_release()
snd_soc_component_unregister()
...
acp3x_dma_close()
i2s_irq_handler()
reads rv_i2s_data->play_stream
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_request_irq() after devm_snd_soc_register_component()
ensures free_irq() synchronizes i2s_irq_handler() before the component
and its PCM substreams are torn down.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204111644.63432-1-phucduc.bui@gmail.com?part=3
next prev parent reply other threads:[~2026-12-04 11:38 UTC|newest]
Thread overview: 17+ 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 [this message]
2026-12-04 11:52 ` Mukunda,Vijendar
2026-12-05 10:28 ` Bui Duc Phuc
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
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
2026-12-05 10:35 ` 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-249698@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.