RE: [PATCH] 2.6.1-mm2: Get irq_vector size right for generic subarchUP installer kernels

From: Zwane Mwaikambo
Date: Sun Jan 18 2004 - 14:09:50 EST


On Thu, 15 Jan 2004, Nakajima, Jun wrote:

> What happens first is you will see kernel data corruption as irq exceeds
> 224 (NR_IRQS).
>
> In setup_IO_APIC_irqs(), for example, we do
> if (IO_APIC_IRQ(irq)) {
> vector = assign_irq_vector(irq);
> entry.vector = vector;
> ioapic_register_intr(irq, vector, IOAPIC_AUTO);
>
> if (!apic && (irq < 16))
> disable_8259A_irq(irq);
> }
>
> Then ioapic_register_intr() does:
> if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
> trigger == IOAPIC_LEVEL)
> irq_desc[irq].handler = &ioapic_level_type;
> else
> irq_desc[irq].handler = &ioapic_edge_type;
> set_intr_gate(vector, interrupt[irq]);
>
> Now of course irq_desc_t irq_desc[NR_IRQS], and same with interrupt[].
>
> I think we need to add checking in IO_APIC_IRQ(irq) like from
> #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) to
>
> #define IO_APIC_IRQ(x) (((x) < NR_IRQS) && ((x) >= 16) || ((1<<(x)) &
> io_apic_irqs))

That looks fine to me, early bailout is safest. James is this ok with you?

Thanks,
Zwane
-
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/