diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-12-29 00:35:11 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-29 06:22:29 -0500 |
commit | efdc64f0c792ea744bcc9203f35b908e66d42f41 (patch) | |
tree | 014d9895f776d98bf933855e5af2da99d5b34824 /kernel | |
parent | 860cf8894b326e4b89720f520540604834337b72 (diff) |
genirq: check chip->ack before calling
Impact: fix theoretical NULL dereference
The generic irq layer doesn't know whether irq_chip has ack routine on some
architectures or not. Upon that, before calling chip->ack, we should check
that it's not NULL.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/irq/chip.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 6eb3c7952b64..0ad02d76a0c4 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -290,7 +290,8 @@ static inline void mask_ack_irq(struct irq_desc *desc, int irq) | |||
290 | desc->chip->mask_ack(irq); | 290 | desc->chip->mask_ack(irq); |
291 | else { | 291 | else { |
292 | desc->chip->mask(irq); | 292 | desc->chip->mask(irq); |
293 | desc->chip->ack(irq); | 293 | if (desc->chip->ack) |
294 | desc->chip->ack(irq); | ||
294 | } | 295 | } |
295 | } | 296 | } |
296 | 297 | ||
@@ -475,7 +476,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) | |||
475 | kstat_incr_irqs_this_cpu(irq, desc); | 476 | kstat_incr_irqs_this_cpu(irq, desc); |
476 | 477 | ||
477 | /* Start handling the irq */ | 478 | /* Start handling the irq */ |
478 | desc->chip->ack(irq); | 479 | if (desc->chip->ack) |
480 | desc->chip->ack(irq); | ||
479 | desc = irq_remap_to_desc(irq, desc); | 481 | desc = irq_remap_to_desc(irq, desc); |
480 | 482 | ||
481 | /* Mark the IRQ currently in progress.*/ | 483 | /* Mark the IRQ currently in progress.*/ |