Re: [PATCH 2/4] gpio: mt7621: more robust management of IRQ domain teardown
From: Sergio Paracuellos
Date: Fri Jun 26 2026 - 02:04:45 EST
Hi Bart,
On Mon, Jun 22, 2026 at 10:12 AM Bartosz Golaszewski <brgl@xxxxxxxxxx> wrote:
>
> 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.
Already sent adding Fixes and CC for patches 1-3 since patch 4 is just
a naming cleanup.
Thanks,
Sergio Paracuellos
>
> Bart