mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Semen Protsenko <semen.protsenko@globallogic.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Grygorii Strashko <grygorii.strashko@globallogic.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH] genirq: check irq_ack callback in handle_edge_irq() before calling
Date: Tue, 21 Apr 2015 16:09:12 +0300	[thread overview]
Message-ID: <1429621752-19082-1-git-send-email-semen.protsenko@globallogic.com> (raw)

Direct calling of .irq_ack callback (from struct irq_chip) leads to NULL
pointer dereference in some cases. E.g. this was observed for MAX732X
driver on hibernation:

    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)

This patch checks if .irq_ack was set, so in case it wasn't (i.e. it's
NULL) we wouldn't have NULL pointer dereference. This check seems to
be pretty common in kernel/irq/chip.c, but it was missed for
handle_edge_irq() function.

Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com>
---
 kernel/irq/chip.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index eb9a4ea..3889b02 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -586,7 +586,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
 	kstat_incr_irqs_this_cpu(irq, desc);
 
 	/* Start handling the irq */
-	desc->irq_data.chip->irq_ack(&desc->irq_data);
+	if (desc->irq_data.chip->irq_ack)
+		desc->irq_data.chip->irq_ack(&desc->irq_data);
 
 	do {
 		if (unlikely(!desc->action)) {
-- 
1.7.9.5


             reply	other threads:[~2015-04-21 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 13:09 Semen Protsenko [this message]
2015-04-21 14:40 ` Thomas Gleixner
2015-04-21 15:28   ` Sam Protsenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429621752-19082-1-git-send-email-semen.protsenko@globallogic.com \
    --to=semen.protsenko@globallogic.com \
    --cc=grygorii.strashko@globallogic.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®