From: sashiko-bot@kernel.org
To: "Vijendar Mukunda" <Vijendar.Mukunda@amd.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 4/4] ASoC: amd: ps: guard SDW IRQ work scheduling with interrupt_enabled flag
Date: Sat, 07 Nov 2026 18:12:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-203157@kernel.org> (raw)
In-Reply-To: <20261107175339.3547918-5-Vijendar.Mukunda@amd.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] ASoC: amd: ps: build failure in acp63_irq_handler() due to
missing struct member
- [Medium] ASoC: amd: ps: TOCTOU race on interrupt_enabled in
acp63_irq_handler()
--
commit 371c40e74acce37765aa0469d9b4a4ac8ef4b3eb
Author: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
ASoC: amd: ps: guard SDW IRQ work scheduling with interrupt_enabled flag
This commit guards SoundWire manager work scheduling in acp63_irq_handler()
with an amd_manager->interrupt_enabled check for both SoundWire instances.
> diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
> index d0b66df101579..0442010e969c0 100644
> --- a/sound/soc/amd/ps/pci-ps.c
> +++ b/sound/soc/amd/ps/pci-ps.c
> @@ -215,7 +215,7 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id)
> writel(ACP_SDW0_STAT, adata->acp63_base + ACP_EXTERNAL_INTR_STAT);
> if (adata->sdw) {
> amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
> - if (amd_manager)
> + if (amd_manager && amd_manager->interrupt_enabled)
> schedule_work(&amd_manager->amd_sdw_irq_thread);
> }
> irq_flag = 1;
> @@ -226,7 +226,7 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id)
> writel(ACP_SDW1_STAT, adata->acp63_base + ACP_EXTERNAL_INTR_STAT1);
> if (adata->sdw) {
> amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
> - if (amd_manager)
> + if (amd_manager && amd_manager->interrupt_enabled)
> schedule_work(&amd_manager->amd_sdw_irq_thread);
> }
> irq_flag = 1;
[Severity: High]
Does this break the build when CONFIG_SND_SOC_AMD_PS is enabled? struct
amd_sdw_manager in include/linux/soundwire/sdw_amd.h has no
interrupt_enabled member, and neither amd_enable_sdw_interrupts() nor
amd_disable_sdw_interrupts() in drivers/soundwire/amd_manager.c sets or
clears such a flag.
[Severity: Medium]
Even with interrupt_enabled added and cleared in
amd_disable_sdw_interrupts(), can acp63_irq_handler() still race with
SoundWire manager teardown and cause a use-after-free of amd_manager?
CPU0 CPU1 (<hardirq>)
amd_sdw_manager_remove()
cancel_work_sync(&amd_sdw_work)
acp63_irq_handler()
amd_manager = dev_get_drvdata(...)
if (amd_manager->interrupt_enabled)
amd_disable_sdw_interrupts()
interrupt_enabled = false
schedule_work(&amd_sdw_irq_thread)
device_unbind_cleanup()
devres_release_all() /* frees amd_manager */
dev_set_drvdata(dev, NULL)
amd_sdw_irq_thread()
/* dereferences freed amd_manager */
<-- use-after-free
acp63_irq_handler() checks dev_get_drvdata() and interrupt_enabled locklessly
in hardirq context on the parent PCI device, while amd_sdw_manager_remove()
never cancels amd_sdw_irq_thread or synchronizes with the parent IRQ before
devres frees amd_manager.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261107175339.3547918-1-Vijendar.Mukunda@amd.com?part=4
next prev parent reply other threads:[~2026-11-07 18:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 17:52 [PATCH 0/4] ASoC: amd: fix IRQ handler races in AMD SoundWire drivers Vijendar Mukunda
2026-11-07 17:52 ` [PATCH 1/4] ASoC: amd: ps: guard adata->sdw dereferences with NULL check in IRQ handler Vijendar Mukunda
2026-11-07 18:12 ` sashiko-bot
2026-11-07 18:33 ` Mukunda,Vijendar
2026-11-07 17:52 ` [PATCH 2/4] ASoC: SOF: amd: " Vijendar Mukunda
2026-11-07 18:11 ` sashiko-bot
2026-11-07 17:52 ` [PATCH 3/4] ASoC: SOF: amd: guard SDW IRQ work scheduling with interrupt_enabled flag Vijendar Mukunda
2026-11-07 18:08 ` sashiko-bot
2026-11-07 18:15 ` Mukunda,Vijendar
2026-11-08 1:25 ` kernel test robot
2026-11-08 4:13 ` Mukunda,Vijendar
2026-11-08 11:08 ` kernel test robot
2026-11-08 11:44 ` Mukunda,Vijendar
2026-11-07 17:52 ` [PATCH 4/4] ASoC: amd: ps: " Vijendar Mukunda
2026-11-07 18:12 ` sashiko-bot [this message]
2026-11-07 18:52 ` Mukunda,Vijendar
2026-11-08 4:16 ` kernel test robot
2026-11-07 19:39 ` [PATCH 0/4] ASoC: amd: fix IRQ handler races in AMD SoundWire drivers Mukunda,Vijendar
2026-11-07 19:46 ` Mukunda,Vijendar
2026-11-09 14:56 ` Mark Brown
2026-11-11 16:05 ` Mukunda,Vijendar
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-203157@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Vijendar.Mukunda@amd.com \
--cc=linux-sound@vger.kernel.org \
--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.