[PATCH] IRQ: Validate irq_ack function pointer before calling it

From: Yang, Fei
Date: Wed Nov 30 2011 - 19:58:30 EST


handle_edge_irq doesn't validate function pointer irq_ack
before calling it. We need to check the pointer for NULL or the
drivers have to implement irq_ack even an empty one. I think the
former is better in case driver doesn't really need irq_ack.

Signed-off-by: Fei Yang <fei.yang@xxxxxxxxx>
Acked-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
---
kernel/irq/chip.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index dc5114b..12f9550 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -448,7 +448,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.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/