Skip to contentSkip to conversation

pinctrl/st: Fix race in installing chained IRQ handler

tip:irq/urgent Maxime Coquelin 2 participants 2 messages Jun 27, 2015 – Jun 29, 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]

Maxime Coquelin

author Acked-by
#1 lore raw

Hello Thomas,

Quoted 60 lines · tip-bot for Thomas Gleixner
Commit-ID:  1b11b0cb799e5f82ca6391a23eaa8f41c7466cc0
Gitweb:     http://git.kernel.org/tip/1b11b0cb799e5f82ca6391a23eaa8f41c7466cc0
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sun, 21 Jun 2015 20:16:15 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 25 Jun 2015 11:57:09 +0200

pinctrl/st: 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);
---
  drivers/pinctrl/pinctrl-st.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-st.c +0 -0
index 65bf73b..10e9c4e8 100644

drivers/pinctrl/pinctrl-st.c static int st_pctl_probe_dt(struct platform_device *pdev, · line 1668

Quoted 10 lines
drivers/pinctrl/pinctrl-st.c +2 -2
@@ -1661,8 +1661,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
  		if (IS_ERR(info->irqmux_base))
  			return PTR_ERR(info->irqmux_base);
 
-		irq_set_chained_handler(irq, st_gpio_irqmux_handler);
-		irq_set_handler_data(irq, info);
+		irq_set_chained_handler_and_data(irq, st_gpio_irqmux_handler,
+						 info);
 
  	}
 

I cannot test the patch before Monday, but it looks good to me:

Thanks!
Maxime

#2 lore raw
In reply to a message not in the archive

Hi Thomas

Quoted 60 lines · tip-bot for Thomas Gleixner
Commit-ID:  1b11b0cb799e5f82ca6391a23eaa8f41c7466cc0
Gitweb:     http://git.kernel.org/tip/1b11b0cb799e5f82ca6391a23eaa8f41c7466cc0
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Sun, 21 Jun 2015 20:16:15 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 25 Jun 2015 11:57:09 +0200

pinctrl/st: 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);
---
  drivers/pinctrl/pinctrl-st.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-st.c +0 -0
index 65bf73b..10e9c4e8 100644

drivers/pinctrl/pinctrl-st.c static int st_pctl_probe_dt(struct platform_device *pdev, · line 1667

Quoted 9 lines
drivers/pinctrl/pinctrl-st.c +2 -2
@@ -1661,8 +1661,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
  		if (IS_ERR(info->irqmux_base))
  			return PTR_ERR(info->irqmux_base);
 
-		irq_set_chained_handler(irq, st_gpio_irqmux_handler);
-		irq_set_handler_data(irq, info);
+		irq_set_chained_handler_and_data(irq, st_gpio_irqmux_handler,
+						 info);
 
  	}

Thanks

Quoted 1 line