diff options
| author | Qingshuang Fu <fuqingshuang@kylinos.cn> | 2026-09-07 10:40:44 +0800 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-09-07 21:49:58 +0200 |
| commit | 0aa45dce2afe6960865de1f32fabd716efaa6fdb (patch) | |
| tree | 076ff10da4402bb41daf225a52e00043e8918215 /include/uapi | |
| parent | 726285316f8fd8965d360ea6546da9b2677e7c7c (diff) | |
| download | linux-next-0aa45dce2afe6960865de1f32fabd716efaa6fdb.tar.gz linux-next-0aa45dce2afe6960865de1f32fabd716efaa6fdb.zip | |
irqdomain: Set IRQ_DOMAIN_FLAG_DESTROY_GC in __irq_domain_instantiate()
When a driver uses irq_domain_instantiate() with dgc_info to create
generic irq chips, IRQ_DOMAIN_FLAG_DESTROY_GC is required so that
irq_domain_remove() can clean up those generic chips.
All existing in-tree callers manually set this flag today, but this
pattern is error-prone. A future new caller forgetting to set the flag
would leave generic chips allocated by irq_domain_alloc_generic_chips()
leaked 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 the flag because:
- irq_domain_instantiate() is a high-level wrapper which internally
allocates the generic chips, so it should also take responsibility
for arranging their cleanup.
- Setting the flag in irq_domain_alloc_generic_chips() would affect
legacy callers like __irq_alloc_domain_generic_chips(), some of
which have custom cleanup paths that manually free the generic
chips (e.g. gpio-tb10x does kfree(domain->gc) before
irq_domain_remove()), leading to use-after-free.
Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20260907024046.28845-2-fuqingshuang@kylinos.cn
Diffstat (limited to 'include/uapi')
0 files changed, 0 insertions, 0 deletions
