lkml.org 
[lkml]   [2008]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[stable PATCH for 2.6.24.5 and 2.6.25] pnpacpi: fix potential corruption on "pnpacpi: exceeded the max number of IRQ resources 2"
    Date
    From: Len Brown <len.brown@intel.com>

    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>

    diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
    index 2dcd196..98cbc9f 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;
    }
    /*

    \
     
     \ /
      Last update: 2008-04-23 06:15    [W:2.694 / U:0.680 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site