Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754463AbbDUNKD (ORCPT ); Tue, 21 Apr 2015 09:10:03 -0400 Received: from exprod5og108.obsmtp.com ([64.18.0.186]:35486 "EHLO exprod5og108.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752503AbbDUNKA (ORCPT ); Tue, 21 Apr 2015 09:10:00 -0400 From: Semen Protsenko To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Grygorii Strashko , Linus Walleij Subject: [PATCH] genirq: check irq_ack callback in handle_edge_irq() before calling Date: Tue, 21 Apr 2015 16:09:12 +0300 Message-Id: <1429621752-19082-1-git-send-email-semen.protsenko@globallogic.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1630 Lines: 46 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/