[lkml]   [2011]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH] genirq: Ensure we locate the passed IRQ in irq_alloc_descs()
    When irq_alloc_descs() is called with no base IRQ specified then it will
    search for a range of IRQs starting from a specified base address. In the
    case where an IRQ is specified it still does this search in order to ensure
    that none of the requested range is already allocated and it still uses the
    from parameter to specify the base for the search. This means that in the
    case where a base is specified but from is zero (which is reasonable as
    any IRQ number is in the range specified by a zero from) the function will
    get confused and try to allocate the first suitably sized block of free IRQs
    it finds.

    Instead use a specified IRQ as the base address for the search, and insist
    that any from that is specified can support that IRQ.

    Signed-off-by: Mark Brown <>
    kernel/irq/irqdesc.c | 6 ++++++
    1 files changed, 6 insertions(+), 0 deletions(-)

    diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
    index 886e803..bb53d6c 100644
    --- a/kernel/irq/irqdesc.c
    +++ b/kernel/irq/irqdesc.c
    @@ -346,6 +346,12 @@ irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node)
    if (!cnt)
    return -EINVAL;

    + if (irq >= 0) {
    + if (from > irq)
    + return -EINVAL;
    + from = irq;
    + }

    start = bitmap_find_next_zero_area(allocated_irqs, IRQ_BITMAP_BITS,

     \ /
      Last update: 2011-06-02 19:57    [W:0.024 / U:7.424 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site