Skip to content

Commit

Permalink
genirq: check chip->ack before calling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wang Chen authored and Ingo Molnar committed Dec 29, 2008
1 parent 860cf88 commit efdc64f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/irq/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ static inline void mask_ack_irq(struct irq_desc *desc, int irq)
desc->chip->mask_ack(irq);
else {
desc->chip->mask(irq);
desc->chip->ack(irq);
if (desc->chip->ack)
desc->chip->ack(irq);
}
}

Expand Down Expand Up @@ -475,7 +476,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
kstat_incr_irqs_this_cpu(irq, desc);

/* Start handling the irq */
desc->chip->ack(irq);
if (desc->chip->ack)
desc->chip->ack(irq);
desc = irq_remap_to_desc(irq, desc);

/* Mark the IRQ currently in progress.*/
Expand Down

0 comments on commit efdc64f

Please sign in to comment.