Re: [PATCH 2/4] gpio: mt7621: more robust management of IRQ domain teardown
From: Bartosz Golaszewski
Date: Mon Jun 22 2026 - 04:20:47 EST
On Sat, 20 Jun 2026 14:01:34 +0200, Sergio Paracuellos
<sergio.paracuellos@xxxxxxxxx> said:
> The driver uses devm_gpiochip_add_data() to register the GPIO chips which
> means the devres subsystem will unregister them only after the function
> 'mt7621_gpio_remove()' returns. During the window between domain destruction
> and devres unregistering the GPIO chips, the chips are still fully active.
> If a consumer or userspace invokes gpiod_to_irq() during this window,
> 'mt7621_gpio_to_irq()' can dereference the already-freed irq domain pointer.
> Thus, manage the IRQ domain teardown using 'devm_add_action_or_reset()' to
> guarantee it is destroyed strictly after the GPIO chips are removed.
>
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
> ---
Same comment as patch 1/4. And the following patches if applicable.
Bart