From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Richard Patel <ripatel@wii.dev>
Cc: vkoul@kernel.org, yung-chuan.liao@linux.intel.com,
pierre-louis.bossart@linux.dev, peter.ujfalusi@linux.intel.com,
linux-sound@vger.kernel.org, patches@opensource.cirrus.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] soundwire: intel_auxdevice: Don't disable IRQs before removing children
Date: Fri, 9 Oct 2026 10:42:21 +0100 [thread overview]
Message-ID: <asi2/benDDdJosVi@opensource.cirrus.com> (raw)
In-Reply-To: <asiygFiibqjVL1AD@wii.dev>
On Fri, Oct 09, 2026 at 09:23:17AM +0000, Richard Patel wrote:
> On Fri, Oct 09, 2026 at 10:03:25AM +0100, Charles Keepax wrote:
> > On Thu, Oct 08, 2026 at 11:11:32PM +0000, Richard Patel wrote:
> > > On Thu, Oct 08, 2026 at 01:41:06PM +0100, Charles Keepax wrote:
> > > > On Mon, Oct 05, 2026 at 02:11:47PM +0100, Charles Keepax wrote:
> > > > > On Mon, Oct 05, 2026 at 11:32:05AM +0100, Charles Keepax wrote:
> > > > > > On Sun, Oct 04, 2026 at 12:29:58PM +0000, Richard Patel wrote:
> > > > > > > On Fri, Sep 25, 2026 at 04:42:16PM +0100, Charles Keepax wrote:
> > > > Ok found some time to look at this properly I think this is all
> > > > fine. sdw_intel_exit() first calls sdw_intel_cleanup() which will
> > > > eventually call sdw_cdns_enable_interrupt(..., false), which
> > > > should disable the SoundWire IRQs. Then sdw_intel_exit() frees
> > > > the ctx, whilst at that point whilst the IRQ is still registered
> > > > one should no longer be able to see soundwire IRQs, so you shouldn't
> > > > get a dereferencing of ctx.
> > >
> > > On my Galaxy Book6, I was able to get a ctx UAF with your v2 patch set
> > > by adding a sleep.
> > Hmm... yeah, I guess the masking ensures a new IRQ can't come in
> > but nothing ensures a currently running IRQ is synchronised in.
> > Well assuming the masking does actually prevent an IRQ coming in.
> >
> > That is a little awkward, normally freeing the IRQ would
> > synchronise it but as the "IRQ" here is done as a pile of
> > callbacks that doesn't happen. We could do a manual sync on the
> > IRQ but that feels like a bit of a layering violation, since
> > the actually IRQ is several layers away in another part of the
> > code. We could add some flags/completions such that we can wait
> > for the current IRQ to finish but feels a bit like adding code
> > that shouldn't exist. I think the correct solution is probably
> > to switch the handling over to the IRQ framework.
> >
> > I am going to go for the theory this is not directly a problem
> > with this series since the problem exists unchanged before and
> > after the series. So lets not block this stuff on it, but I will
>
> Yep, sounds good :-) Thanks again for the fixes.
>
> > try to find time to start porting more of the handling over to
> > the IRQ framework, or happy to help review if you would rather
> > take a run at it.
>
> I was going to defer kfree(ctx) via RCU, what do you think?
My slight concern would be it is tackling the UAF directly, but
really the problem here is the IRQ handler is still running after
the link device has been destroyed. It seems quite likely you can
end up with other problems, which we may have to add other
mitigations for later. So doing something to ensure the IRQ
thread has completed (or at least the SoundWire part there of) in
intel_link_remove after the IRQ is disabled feels more robust.
However, that said if the changes are small and neat then it
certainly improves the current situation, so I am not totally
against the idea.
Thanks,
Charles
next prev parent reply other threads:[~2026-10-09 9:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 15:42 [PATCH v2 0/3] Allow SoundWire devices to communicate during remove Charles Keepax
2026-09-25 15:42 ` [PATCH v2 1/3] soundwire: bus: Don't unassign dev_num before unregistering device Charles Keepax
2026-10-03 8:18 ` Vinod Koul
2026-10-05 9:08 ` Charles Keepax
2026-09-25 15:42 ` [PATCH v2 2/3] soundwire: bus: Expose a helper to remove devices from the bus Charles Keepax
2026-09-25 15:42 ` [PATCH v2 3/3] soundwire: intel_auxdevice: Don't disable IRQs before removing children Charles Keepax
2026-09-26 15:55 ` Pierre-Louis Bossart
2026-09-28 8:39 ` Charles Keepax
2026-09-29 8:34 ` Pierre-Louis Bossart
2026-09-29 12:40 ` Charles Keepax
2026-09-29 18:31 ` Pierre-Louis Bossart
2026-10-04 12:29 ` Richard Patel
2026-10-05 10:32 ` Charles Keepax
2026-10-05 13:11 ` Charles Keepax
2026-10-08 12:41 ` Charles Keepax
2026-10-08 23:11 ` Richard Patel
2026-10-09 9:03 ` Charles Keepax
2026-10-09 9:23 ` Richard Patel
2026-10-09 9:42 ` Charles Keepax [this message]
2026-09-29 18:34 ` [PATCH v2 0/3] Allow SoundWire devices to communicate during remove Pierre-Louis Bossart
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=asi2/benDDdJosVi@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=ripatel@wii.dev \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.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
all inboxes | Powered by JetHome®