Prev: [PATCH 08/13] Fix possible NULL pointer dereference in print_IO_APIC
Next: [PATCH 06/13] Allow xen platform pci device to be compiled as a module
From: stefano on 21 Jun 2010 12:30 From: Stefano Stabellini <stefano.stabellini(a)eu.citrix.com> Don't break the assumption that the first 16 irqs are ISA irqs; make sure that the irq is actually free before using it. Signed-off-by: Stefano Stabellini <stefano.stabellini(a)eu.citrix.com> --- drivers/xen/events.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 0f7546e..b029a32 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -340,9 +340,18 @@ static int find_unbound_irq(void) int irq; struct irq_desc *desc; - for (irq = 0; irq < nr_irqs; irq++) + for (irq = 0; irq < nr_irqs; irq++) { + desc = irq_to_desc(irq); + /* only 0->15 have init'd desc; handle irq > 16 */ + if (desc == NULL) + break; + if (desc->chip == &no_irq_chip) + break; + if (desc->chip != &xen_dynamic_chip) + continue; if (irq_info[irq].type == IRQT_UNBOUND) break; + } if (irq == nr_irqs) panic("No available IRQ to bind to: increase nr_irqs!\n"); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |