Skip to contentSkip to conversation

mfd/asic3: Fix race in installing chained IRQ handler

tip:irq/urgent Lee Jones 2 participants 3 messages Jul 1, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Lee Jones

author Applied
#1 lore raw
Quoted 41 lines · tip-bot for Thomas Gleixner
Commit-ID:  c30e30478c74e5be2fa3bbe954084a31f0d60570
Gitweb:     http://git.kernel.org/tip/c30e30478c74e5be2fa3bbe954084a31f0d60570
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sun, 21 Jun 2015 20:16:06 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 25 Jun 2015 11:56:52 +0200

mfd/asic3: Fix race in installing chained IRQ handler

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().

Search and conversion was done with coccinelle:

@@
expression E1, E2, E3;
@@
(

(quoted diff) +0 -2
-if (irq_set_chained_handler(E1, E3) != 0)
-   BUG();

|
-irq_set_chained_handler(E1, E3);
)

(quoted diff) +1 -1
-irq_set_handler_data(E1, E2);
+irq_set_chained_handler_and_data(E1, E3, E2);

@@
expression E1, E2, E3;
@@
(

(quoted diff) +0 -2
-if (irq_set_chained_handler(E1, E3) != 0)
-   BUG();
...

|
-irq_set_chained_handler(E1, E3);
...
)

(quoted diff) +1 -1
-irq_set_handler_data(E1, E2);
+irq_set_chained_handler_and_data(E1, E3, E2);
Quoted 8 lines
---
 drivers/mfd/asic3.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Applied to MFD -fixes.

Quoted 15 lines
drivers/mfd/asic3.c +1 -2
index 977bd3a..120df5c 100644
@@ -417,9 +417,8 @@ static int __init asic3_irq_probe(struct platform_device *pdev)
 	asic3_write_register(asic, ASIC3_OFFSET(INTR, INT_MASK),
 			     ASIC3_INTMASK_GINTMASK);
 
-	irq_set_chained_handler(asic->irq_nr, asic3_irq_demux);
+	irq_set_chained_handler_and_data(asic->irq_nr, asic3_irq_demux, asic);
 	irq_set_irq_type(asic->irq_nr, IRQ_TYPE_EDGE_RISING);
-	irq_set_handler_data(asic->irq_nr, asic);
 
 	return 0;
 }
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw
Quoted 2 lines · Lee Jones

Applied to MFD -fixes.

I have it queued already and will send it to Linus later today.

Thanks,

tglx

author
#3 lore raw
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines · Lee Jones

Applied to MFD -fixes.

I have it queued already and will send it to Linus later today.

Fine, un-queued.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog