Эх сурвалжийг харах

Merge branch 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'irq-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  genirq: Disable the SHIRQ_DEBUG call in request_threaded_irq for now
  genirq: Prevent access beyond allocated_irqs bitmap
Linus Torvalds 14 жил өмнө
parent
commit
571020df6f

+ 6 - 0
kernel/irq/internals.h

@@ -3,6 +3,12 @@
  */
  */
 #include <linux/irqdesc.h>
 #include <linux/irqdesc.h>
 
 
+#ifdef CONFIG_SPARSE_IRQ
+# define IRQ_BITMAP_BITS	(NR_IRQS + 8196)
+#else
+# define IRQ_BITMAP_BITS	NR_IRQS
+#endif
+
 extern int noirqdebug;
 extern int noirqdebug;
 
 
 #define irq_data_to_desc(data)	container_of(data, struct irq_desc, irq_data)
 #define irq_data_to_desc(data)	container_of(data, struct irq_desc, irq_data)

+ 10 - 1
kernel/irq/irqdesc.c

@@ -94,7 +94,7 @@ int nr_irqs = NR_IRQS;
 EXPORT_SYMBOL_GPL(nr_irqs);
 EXPORT_SYMBOL_GPL(nr_irqs);
 
 
 static DEFINE_MUTEX(sparse_irq_lock);
 static DEFINE_MUTEX(sparse_irq_lock);
-static DECLARE_BITMAP(allocated_irqs, NR_IRQS);
+static DECLARE_BITMAP(allocated_irqs, IRQ_BITMAP_BITS);
 
 
 #ifdef CONFIG_SPARSE_IRQ
 #ifdef CONFIG_SPARSE_IRQ
 
 
@@ -217,6 +217,15 @@ int __init early_irq_init(void)
 	initcnt = arch_probe_nr_irqs();
 	initcnt = arch_probe_nr_irqs();
 	printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d %d\n", NR_IRQS, nr_irqs, initcnt);
 	printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d %d\n", NR_IRQS, nr_irqs, initcnt);
 
 
+	if (WARN_ON(nr_irqs > IRQ_BITMAP_BITS))
+		nr_irqs = IRQ_BITMAP_BITS;
+
+	if (WARN_ON(initcnt > IRQ_BITMAP_BITS))
+		initcnt = IRQ_BITMAP_BITS;
+
+	if (initcnt > nr_irqs)
+		nr_irqs = initcnt;
+
 	for (i = 0; i < initcnt; i++) {
 	for (i = 0; i < initcnt; i++) {
 		desc = alloc_desc(i, node);
 		desc = alloc_desc(i, node);
 		set_bit(i, allocated_irqs);
 		set_bit(i, allocated_irqs);

+ 1 - 1
kernel/irq/manage.c

@@ -1100,7 +1100,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
 	if (retval)
 	if (retval)
 		kfree(action);
 		kfree(action);
 
 
-#ifdef CONFIG_DEBUG_SHIRQ
+#ifdef CONFIG_DEBUG_SHIRQ_FIXME
 	if (!retval && (irqflags & IRQF_SHARED)) {
 	if (!retval && (irqflags & IRQF_SHARED)) {
 		/*
 		/*
 		 * It's a shared IRQ -- the driver ought to be prepared for it
 		 * It's a shared IRQ -- the driver ought to be prepared for it

+ 1 - 1
kernel/irq/resend.c

@@ -23,7 +23,7 @@
 #ifdef CONFIG_HARDIRQS_SW_RESEND
 #ifdef CONFIG_HARDIRQS_SW_RESEND
 
 
 /* Bitmap to handle software resend of interrupts: */
 /* Bitmap to handle software resend of interrupts: */
-static DECLARE_BITMAP(irqs_resend, NR_IRQS);
+static DECLARE_BITMAP(irqs_resend, IRQ_BITMAP_BITS);
 
 
 /*
 /*
  * Run software resends of IRQ's
  * Run software resends of IRQ's