diff options
author | Len Brown <len.brown@intel.com> | 2008-04-23 00:09:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-23 15:22:13 -0400 |
commit | 0093cb1199ec551f179562ca9fbd6f64fb750645 (patch) | |
tree | a17c2166db3d0f78d3ef7400d396476a70c58903 /drivers/pnp | |
parent | 94bc891b00e40cbec375feb4568780af183fd7f4 (diff) |
pnpacpi: fix potential corruption on "pnpacpi: exceeded the max number of IRQ resources 2"
PNP_MAX_IRQ is 2
If a device invokes pnpacpi_parse_allocated_irqresource() 0, 1, or 2 times, we are happy.
The 3rd time, we will fail and print "pnpacpi: exceeded the max number of IRQ resources: 2"
The 4th and subsequent calls (if this ever happened) would silently scribble on
irq_resource[2], which doesn't actualy exist.
Found-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 2dcd1960aca8..98cbc9f18eed 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -84,10 +84,12 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
84 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && | 84 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && |
85 | i < PNP_MAX_IRQ) | 85 | i < PNP_MAX_IRQ) |
86 | i++; | 86 | i++; |
87 | if (i >= PNP_MAX_IRQ && !warned) { | 87 | if (i >= PNP_MAX_IRQ) { |
88 | printk(KERN_WARNING "pnpacpi: exceeded the max number of IRQ " | 88 | if (!warned) { |
89 | "resources: %d \n", PNP_MAX_IRQ); | 89 | printk(KERN_WARNING "pnpacpi: exceeded the max number" |
90 | warned = 1; | 90 | " of IRQ resources: %d\n", PNP_MAX_IRQ); |
91 | warned = 1; | ||
92 | } | ||
91 | return; | 93 | return; |
92 | } | 94 | } |
93 | /* | 95 | /* |