Re: [PATCH 05/10] iio: adc: stm32-adc: Detach chained IRQ handler before removing domain
From: Jonathan Cameron
Date: Sat Nov 21 2026 - 17:51:23 EST
On Fri, 20 Nov 2026 18:23:19 +0100
Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx> wrote:
> On 11/19/26 16:30, Lee Jones wrote:
> > stm32_adc_irq_remove() disposes of the child IRQ mappings and removes
> > priv->domain before clearing the parent chained IRQ handlers. Because
> > the parent hardware interrupt lines remain unmasked while child devices
> > use dummy_irq_chip, an interrupt arriving during teardown invokes
> > stm32_adc_irq_handler() after irq_domain_remove() has freed
> > priv->domain, and irq_set_chained_handler() also leaves handler_data
> > dangling.
> >
> > Detach the chained handlers and clear handler_data with
> > irq_set_chained_handler_and_data() before tearing down the mappings and
> > removing the domain.
> >
> > Fixes: 1add69880240 ("iio: adc: Add support for STM32 ADC core")
> > Closes: https://sashiko.dev/#/bug/linux-27c38690-bc20-43aa-a3fc-1ddd6f1bb74e
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> > ---
>
> Hi Lee,
>
> Acked-by: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx>
This one seems a little more likely to be hit in practice, but
it doesn't apply to the fixes tree due to some other recent changes and
I'm lazy.
Hence applied to the testing branch of iio.git to line it up for next
merge cycle. We are getting late enough I should be keeping fixes to critical
stuff only and I'm going to assume this one isn't.
Jonathan
> Best Regards,
> Thanks,
> Fabrice
>
> > drivers/iio/adc/stm32-adc-core.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
> > index 4b532db3db62..13b75475046c 100644
> > --- a/drivers/iio/adc/stm32-adc-core.c
> > +++ b/drivers/iio/adc/stm32-adc-core.c
> > @@ -467,12 +467,12 @@ static void stm32_adc_irq_remove(struct platform_device *pdev,
> > int hwirq;
> > unsigned int i;
> >
> > + for (i = 0; i < priv->nb_irqs; i++)
> > + irq_set_chained_handler_and_data(priv->irq[i], NULL, NULL);
> > +
> > for (hwirq = 0; hwirq < priv->nb_adc_max; hwirq++)
> > irq_dispose_mapping(irq_find_mapping(priv->domain, hwirq));
> > irq_domain_remove(priv->domain);
> > -
> > - for (i = 0; i < priv->nb_irqs; i++)
> > - irq_set_chained_handler(priv->irq[i], NULL);
> > }
> >
> > static int stm32_adc_core_switches_supply_en(struct stm32_adc_priv *priv,
>
>