From: Len Brown Date: Wed, 23 Apr 2008 04:09:13 +0000 (-0400) Subject: pnpacpi: fix potential corruption on "pnpacpi: exceeded the max number of IRQ resourc... X-Git-Tag: v2.6.26-rc1~1096 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=0093cb1199ec551f179562ca9fbd6f64fb750645;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Len Brown Signed-off-by: Linus Torvalds --- diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 2dcd1960aca..98cbc9f18ee 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, while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_IRQ) i++; - if (i >= PNP_MAX_IRQ && !warned) { - printk(KERN_WARNING "pnpacpi: exceeded the max number of IRQ " - "resources: %d \n", PNP_MAX_IRQ); - warned = 1; + if (i >= PNP_MAX_IRQ) { + if (!warned) { + printk(KERN_WARNING "pnpacpi: exceeded the max number" + " of IRQ resources: %d\n", PNP_MAX_IRQ); + warned = 1; + } return; } /*