linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: stm32-adc: Fix race in installing chained IRQ handler
@ 2025-05-14  8:51 Chen Ni
  2025-05-14 12:22 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2025-05-14  8:51 UTC (permalink / raw)
  To: jic23, dlechner, nuno.sa, andy, mcoquelin.stm32, alexandre.torgue,
	u.kleine-koenig, robh, tglx, jirislaby
  Cc: linux-iio, linux-stm32, linux-arm-kernel, linux-kernel, Chen Ni

Fix a race where a pending interrupt could be received and the handler
called before the handler's data has been setup, by converting to
irq_set_chained_handler_and_data().

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/iio/adc/stm32-adc-core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
index bd3458965bff..21c04a98b3b6 100644
--- a/drivers/iio/adc/stm32-adc-core.c
+++ b/drivers/iio/adc/stm32-adc-core.c
@@ -430,10 +430,9 @@ static int stm32_adc_irq_probe(struct platform_device *pdev,
 		return -ENOMEM;
 	}
 
-	for (i = 0; i < priv->cfg->num_irqs; i++) {
-		irq_set_chained_handler(priv->irq[i], stm32_adc_irq_handler);
-		irq_set_handler_data(priv->irq[i], priv);
-	}
+	for (i = 0; i < priv->cfg->num_irqs; i++)
+		irq_set_chained_handler_and_data(priv->irq[i],
+						 stm32_adc_irq_handler, priv);
 
 	return 0;
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: adc: stm32-adc: Fix race in installing chained IRQ handler
  2025-05-14  8:51 [PATCH] iio: adc: stm32-adc: Fix race in installing chained IRQ handler Chen Ni
@ 2025-05-14 12:22 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2025-05-14 12:22 UTC (permalink / raw)
  To: Chen Ni
  Cc: jic23, dlechner, nuno.sa, mcoquelin.stm32, alexandre.torgue,
	u.kleine-koenig, robh, tglx, jirislaby, linux-iio, linux-stm32,
	linux-arm-kernel, linux-kernel

On Wed, May 14, 2025 at 04:51:38PM +0800, Chen Ni wrote:
> Fix a race where a pending interrupt could be received and the handler
> called before the handler's data has been setup, by converting to
> irq_set_chained_handler_and_data().

Sounds like it needs a Fixes tag.

-- 
With Best Regards,
Andy Shevchenko




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-14 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14  8:51 [PATCH] iio: adc: stm32-adc: Fix race in installing chained IRQ handler Chen Ni
2025-05-14 12:22 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).