From: Thomas Gleixner <tglx@kernel.org>
To: Mark Brown <broonie@kernel.org>, linux-kernel@vger.kernel.org
Cc: Farhad Alemi <farhad.alemi@berkeley.edu>,
Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH] regmap: irq: Free the irqdomain we create
Date: Fri, 04 Sep 2026 21:05:26 +0200 [thread overview]
Message-ID: <87jyp07s7d.ffs@fw13> (raw)
In-Reply-To: <87mrtw7sf3.ffs@fw13>
On Fri, Sep 04 2026 at 21:00, Thomas Gleixner wrote:
> On Tue, Sep 01 2026 at 22:55, Mark Brown wrote:
>> err_domain:
>> - /* Should really dispose of the domain but... */
>> + irq_domain_remove(d->domain);
>
> That won't work.
>
> The case which is affected is the one which allocates interrupts
> upfront via alloc_irq_descs().
>
> In that case the domain creation will associate allocated interrupts
> because info.virq_base is > 0.
>
> This wont trigger the WARN_ON() in irq_domain_remove() because it's a
> fixed sized linear domain, but irq_domain_remove() will leak the
> interrupt descriptors which still have a reference (pointer) to the irq
> chip and the domain. So the same UAF is still there :)
>
> What you need to do before removing the domain is
>
> if (irq_base > 0)
> irq_domain_free_irqs(irq_base, chip->num_irqs);
Hit send too fast. That stupidly works only when hierarchical domains
are enabled.
So you need:
if (irq_base > 0) {
for (unsigned int i = 0; i < chip->num_irqs; i++)
irq_dispose_mapping(irq_base + i);
}
irqdomain_remove_domain();
Thanks,
tglx
next prev parent reply other threads:[~2026-09-04 19:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 21:55 Mark Brown
2026-09-01 22:49 ` Mark Brown
2026-09-04 19:00 ` Thomas Gleixner
2026-09-04 19:05 ` Thomas Gleixner [this message]
2026-09-04 19:21 ` Mark Brown
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=87jyp07s7d.ffs@fw13 \
--to=tglx@kernel.org \
--cc=broonie@kernel.org \
--cc=farhad.alemi@berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
/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®