linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] gpio: max732x: Fix irq-events handler
@ 2015-04-22 13:20 Semen Protsenko
  2015-04-24 10:29 ` Grygorii Strashko
  2015-05-06 13:09 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Semen Protsenko @ 2015-04-22 13:20 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, linux-kernel, Grygorii Strashko

MAX732X clears all pending interrupts on I2C read (when interrupts
register is being read). Driver doesn't need to send any ACKs when
interrupt was handled. So replace handle_edge_irq() with
handle_simple_irq().

Using handle_edge_irq() (w/o .irq_ack callback set) may lead to NULL
pointer dereference in some cases. E.g. this was observed on
hibernation process:

  Unable to handle kernel NULL pointer dereference at virtual address 0
  Backtrace:
  (handle_edge_irq) from (resend_irqs)
  (resend_irqs) from (tasklet_action)
  (tasklet_action) from (__do_softirq)
  (__do_softirq) from (run_ksoftirqd)
  (run_ksoftirqd) from (smpboot_thread_fn)
  (smpboot_thread_fn) from (kthread)
  (kthread) from (ret_from_fork)

Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com>
---
 drivers/gpio/gpio-max732x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 1885e5c..86dc6b3 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -530,7 +530,7 @@ static int max732x_irq_setup(struct max732x_chip *chip,
 		ret =  gpiochip_irqchip_add(&chip->gpio_chip,
 					    &max732x_irq_chip,
 					    irq_base,
-					    handle_edge_irq,
+					    handle_simple_irq,
 					    IRQ_TYPE_NONE);
 		if (ret) {
 			dev_err(&client->dev,
-- 
1.7.9.5


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

* Re: [PATCH v2] gpio: max732x: Fix irq-events handler
  2015-04-22 13:20 [PATCH v2] gpio: max732x: Fix irq-events handler Semen Protsenko
@ 2015-04-24 10:29 ` Grygorii Strashko
  2015-05-06 13:09 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Grygorii Strashko @ 2015-04-24 10:29 UTC (permalink / raw)
  To: Semen Protsenko, Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, linux-kernel, Grygorii Strashko

On 04/22/2015 04:20 PM, Semen Protsenko wrote:
> MAX732X clears all pending interrupts on I2C read (when interrupts
> register is being read). Driver doesn't need to send any ACKs when
> interrupt was handled. So replace handle_edge_irq() with
> handle_simple_irq().
>
> Using handle_edge_irq() (w/o .irq_ack callback set) may lead to NULL
> pointer dereference in some cases. E.g. this was observed on
> hibernation process:
>
>    Unable to handle kernel NULL pointer dereference at virtual address 0
>    Backtrace:
>    (handle_edge_irq) from (resend_irqs)
>    (resend_irqs) from (tasklet_action)
>    (tasklet_action) from (__do_softirq)
>    (__do_softirq) from (run_ksoftirqd)
>    (run_ksoftirqd) from (smpboot_thread_fn)
>    (smpboot_thread_fn) from (kthread)
>    (kthread) from (ret_from_fork)
>
> Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com>

Reviewed-by: Grygorii Strashko <grygorii.strashko@linaro.org>

> ---
>   drivers/gpio/gpio-max732x.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
> index 1885e5c..86dc6b3 100644
> --- a/drivers/gpio/gpio-max732x.c
> +++ b/drivers/gpio/gpio-max732x.c
> @@ -530,7 +530,7 @@ static int max732x_irq_setup(struct max732x_chip *chip,
>   		ret =  gpiochip_irqchip_add(&chip->gpio_chip,
>   					    &max732x_irq_chip,
>   					    irq_base,
> -					    handle_edge_irq,
> +					    handle_simple_irq,
>   					    IRQ_TYPE_NONE);
>   		if (ret) {
>   			dev_err(&client->dev,
>


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

* Re: [PATCH v2] gpio: max732x: Fix irq-events handler
  2015-04-22 13:20 [PATCH v2] gpio: max732x: Fix irq-events handler Semen Protsenko
  2015-04-24 10:29 ` Grygorii Strashko
@ 2015-05-06 13:09 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-05-06 13:09 UTC (permalink / raw)
  To: Semen Protsenko
  Cc: Alexandre Courbot, linux-gpio, linux-kernel, Grygorii Strashko

On Wed, Apr 22, 2015 at 3:20 PM, Semen Protsenko
<semen.protsenko@globallogic.com> wrote:

> MAX732X clears all pending interrupts on I2C read (when interrupts
> register is being read). Driver doesn't need to send any ACKs when
> interrupt was handled. So replace handle_edge_irq() with
> handle_simple_irq().
>
> Using handle_edge_irq() (w/o .irq_ack callback set) may lead to NULL
> pointer dereference in some cases. E.g. this was observed on
> hibernation process:
>
>   Unable to handle kernel NULL pointer dereference at virtual address 0
>   Backtrace:
>   (handle_edge_irq) from (resend_irqs)
>   (resend_irqs) from (tasklet_action)
>   (tasklet_action) from (__do_softirq)
>   (__do_softirq) from (run_ksoftirqd)
>   (run_ksoftirqd) from (smpboot_thread_fn)
>   (smpboot_thread_fn) from (kthread)
>   (kthread) from (ret_from_fork)
>
> Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com>

Patch applied with Grygorii's Review tag.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-05-06 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 13:20 [PATCH v2] gpio: max732x: Fix irq-events handler Semen Protsenko
2015-04-24 10:29 ` Grygorii Strashko
2015-05-06 13:09 ` Linus Walleij

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