All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq: Ensure we locate the passed IRQ in irq_alloc_descs()
@ 2011-06-02 17:55 Mark Brown
  2011-06-03  9:24 ` Milton Miller
  2011-06-03 12:59 ` [tip:irq/urgent] " tip-bot for Mark Brown
  0 siblings, 2 replies; 12+ messages in thread
From: Mark Brown @ 2011-06-02 17:55 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, Mark Brown

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 <broonie@opensource.wolfsonmicro.com>
---
 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;
+	}
+
 	mutex_lock(&sparse_irq_lock);
 
 	start = bitmap_find_next_zero_area(allocated_irqs, IRQ_BITMAP_BITS,
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-06-06 21:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-02 17:55 [PATCH] genirq: Ensure we locate the passed IRQ in irq_alloc_descs() Mark Brown
2011-06-03  9:24 ` Milton Miller
2011-06-03 10:42   ` Mark Brown
2011-06-03 14:43     ` Milton Miller
2011-06-03 15:06       ` Mark Brown
2011-06-03 16:25       ` Thomas Gleixner
2011-06-04  0:23         ` Milton Miller
2011-06-04  9:51           ` Mark Brown
2011-06-06 19:42             ` Grant Likely
2011-06-06 20:57               ` Mark Brown
2011-06-06 21:33                 ` Grant Likely
2011-06-03 12:59 ` [tip:irq/urgent] " tip-bot for Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.