From: Thomas Gleixner <tglx@kernel.org>
To: Qingshuang Fu <fuqingshuang@kylinos.cn>,
Radu Rendec <radu@rendec.net>, Andy Whitcroft <apw@canonical.com>,
Joe Perches <joe@perches.com>,
Herve Codina <herve.codina@bootlin.com>
Cc: linux-kernel@vger.kernel.org, Qingshuang Fu <fuqingshuang@kylinos.cn>
Subject: Re: [PATCH v2] irqdomain: Auto-set IRQ_DOMAIN_FLAG_DESTROY_GC in __irq_domain_instantiate()
Date: Fri, 04 Sep 2026 17:19:10 +0200 [thread overview]
Message-ID: <87se3p6o41.ffs@fw13> (raw)
In-Reply-To: <20260904070943.934476-1-fuqingshuang@kylinos.cn>
On Fri, Sep 04 2026 at 15:09, Qingshuang Fu wrote:
> When a driver uses irq_domain_instantiate() with dgc_info to create
> generic irq chips, the domain is expected to automatically clean up
> the generic chips when irq_domain_remove() is called. However,
> __irq_domain_instantiate() does not set the IRQ_DOMAIN_FLAG_DESTROY_GC
> flag which is required by irq_domain_remove() to trigger cleanup.
>
> Currently all existing callers of irq_domain_instantiate() with dgc_info
> manually set this flag, which is error-prone. If a future caller forgets to
> set the flag, generic chips allocated by irq_domain_alloc_generic_chips()
> will leak on domain removal.
>
> Set IRQ_DOMAIN_FLAG_DESTROY_GC right after irq_domain_alloc_generic_chips()
> succeeds inside __irq_domain_instantiate().
>
> This makes automatic cleanup the default for all users that provide
> dgc_info via irq_domain_instantiate().
>
> This is the correct location for several reasons:
> - irq_domain_instantiate() is a high-level wrapper which internally
> allocates the generic chips, so it should also take responsibility
> for arranging their cleanup.
> - Automatically setting the flag inside irq_domain_alloc_generic_chips()
> would affect legacy callers like __irq_alloc_domain_generic_chips(),
> some of which perform custom manual cleanup and could hit use-after-free.
>
> Fixes: e6f67ce32e8e ("irqdomain: Add support for generic irq chips creation before publishing a domain")
This does not fix anything.
All users which invoke irq_domain_instantiate() with info->dgc_info
populated set the flag, no?
And instead of adding a bogus Fixes tag, you could have made a series
which removes the redundant flag from the three perfectly fine working
drivers.
prev parent reply other threads:[~2026-09-04 15:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 6:59 [PATCH] genirq/generic-chip: Set IRQ_DOMAIN_FLAG_DESTROY_GC in irq_domain_alloc_generic_chips() Qingshuang Fu
2026-09-03 22:37 ` Herve Codina
2026-09-04 6:26 ` Thomas Gleixner
2026-09-04 7:25 ` Qingshuang Fu
2026-09-04 7:09 ` [PATCH v2] irqdomain: Auto-set IRQ_DOMAIN_FLAG_DESTROY_GC in __irq_domain_instantiate() Qingshuang Fu
2026-09-04 11:09 ` Herve Codina
2026-09-04 15:19 ` Thomas Gleixner [this message]
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=87se3p6o41.ffs@fw13 \
--to=tglx@kernel.org \
--cc=apw@canonical.com \
--cc=fuqingshuang@kylinos.cn \
--cc=herve.codina@bootlin.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=radu@rendec.net \
/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.