Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vijendar Mukunda" <Vijendar.Mukunda@amd.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 3/4] ASoC: SOF: amd: guard SDW IRQ work scheduling with interrupt_enabled flag
Date: Sat, 07 Nov 2026 18:08:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-203151@kernel.org> (raw)
In-Reply-To: <20261107175339.3547918-4-Vijendar.Mukunda@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] ASoC: SOF: amd: build failure in acp_irq_handler() on missing
  struct member
- [Medium] ASoC: SOF: amd: unguarded work queue in
  sof_acp7x_handle_sdw_manager_irq()
--

commit 84b5998c660c53c97f1f81d73a850a90f66dfb5d
Author: Vijendar Mukunda <Vijendar.Mukunda@amd.com>

ASoC: SOF: amd: guard SDW IRQ work scheduling with interrupt_enabled flag

This commit checks amd_manager->interrupt_enabled before calling
schedule_work(&amd_manager->amd_sdw_irq_thread) in acp_irq_handler().

> diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
> index 623e016f38b83..5c4eab0be497c 100644
> --- a/sound/soc/sof/amd/acp.c
> +++ b/sound/soc/sof/amd/acp.c
> @@ -586,7 +586,7 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id)
>  		snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_stat, ACP_SDW0_IRQ_MASK);
>  		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;
> @@ -618,7 +618,7 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id)
>  					  ACP_SDW1_IRQ_MASK);
>  			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_SOF_AMD_COMMON is enabled?
struct amd_sdw_manager in include/linux/soundwire/sdw_amd.h has no
interrupt_enabled member, and amd_enable_sdw_interrupts() and
amd_disable_sdw_interrupts() in drivers/soundwire/amd_manager.c only update
hardware interrupt mask registers without setting or clearing any software
flag.

[Severity: Medium]
Assuming interrupt_enabled is added to struct amd_sdw_manager, should
sof_acp7x_handle_sdw_manager_irq() also check amd_manager->interrupt_enabled
before queuing amd_sdw_irq_thread?

sound/soc/sof/amd/acp.c:sof_acp7x_handle_sdw_manager_irq() {
	...
		amd_manager = dev_get_drvdata(&adata->sdw->pdev[instance]->dev);
		if (amd_manager)
			schedule_work(&amd_manager->amd_sdw_irq_thread);
}

On ACP7x platforms, an in-flight IRQ in acp7x_irq_handler() racing with
amd_sdw_manager_remove() or amd_deinit_sdw_manager() can still queue
amd_sdw_irq_thread after interrupts are disabled and pending work is
cancelled, leading to a use-after-free on amd_manager or register accesses
to a disabled manager.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261107175339.3547918-1-Vijendar.Mukunda@amd.com?part=3

  reply	other threads:[~2026-11-07 18:08 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 [this message]
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
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-203151@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox