diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-06-27 18:57:12 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2008-07-16 17:27:07 -0400 |
commit | fe2cf598e6942abd8fb70fee230d74b1a1eae0d1 (patch) | |
tree | 9b812788832205f05d2d1cf3bdb654702a7824d0 /drivers/pnp/pnpacpi | |
parent | c227536b4cc2600fc9d22ba0067f699165f6621f (diff) |
PNPACPI: ignore _PRS interrupt numbers larger than PNP_IRQ_NR
ACPI Extended Interrupt Descriptors can encode 32-bit interrupt
numbers, so an interrupt number may exceed the size of the bitmap
we use to track possible IRQ settings.
To avoid corrupting memory, complain and ignore too-large interrupt
numbers.
There's similar code in pnpacpi_parse_irq_option(), but I didn't
change that because the small IRQ descriptor can only encode
IRQs 0-15, which do not exceed bitmap size.
In the future, we could handle IRQ numbers greater than PNP_IRQ_NR
by replacing the bitmap with a table or list.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 3aaf406b67b8..851c773feae1 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -455,9 +455,16 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev, | |||
455 | return; | 455 | return; |
456 | 456 | ||
457 | bitmap_zero(map.bits, PNP_IRQ_NR); | 457 | bitmap_zero(map.bits, PNP_IRQ_NR); |
458 | for (i = 0; i < p->interrupt_count; i++) | 458 | for (i = 0; i < p->interrupt_count; i++) { |
459 | if (p->interrupts[i]) | 459 | if (p->interrupts[i]) { |
460 | __set_bit(p->interrupts[i], map.bits); | 460 | if (p->interrupts[i] < PNP_IRQ_NR) |
461 | __set_bit(p->interrupts[i], map.bits); | ||
462 | else | ||
463 | dev_err(&dev->dev, "ignoring IRQ %d option " | ||
464 | "(too large for %d entry bitmap)\n", | ||
465 | p->interrupts[i], PNP_IRQ_NR); | ||
466 | } | ||
467 | } | ||
461 | 468 | ||
462 | flags = irq_flags(p->triggering, p->polarity, p->sharable); | 469 | flags = irq_flags(p->triggering, p->polarity, p->sharable); |
463 | pnp_register_irq_resource(dev, option, &map, flags); | 470 | pnp_register_irq_resource(dev, option, &map, flags); |