[PATCH] Check the irq number is within bounds

Most of the functions already check. Do the ones that didn't.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Matthew Wilcox and committed by Linus Torvalds c2b5a251 2d0ebb36

+15
+15
kernel/irq/manage.c
··· 36 36 { 37 37 struct irq_desc *desc = irq_desc + irq; 38 38 39 + if (irq >= NR_IRQS) 40 + return; 41 + 39 42 while (desc->status & IRQ_INPROGRESS) 40 43 cpu_relax(); 41 44 } ··· 62 59 { 63 60 irq_desc_t *desc = irq_desc + irq; 64 61 unsigned long flags; 62 + 63 + if (irq >= NR_IRQS) 64 + return; 65 65 66 66 spin_lock_irqsave(&desc->lock, flags); 67 67 if (!desc->depth++) { ··· 92 86 { 93 87 irq_desc_t *desc = irq_desc + irq; 94 88 89 + if (irq >= NR_IRQS) 90 + return; 91 + 95 92 disable_irq_nosync(irq); 96 93 if (desc->action) 97 94 synchronize_irq(irq); ··· 116 107 { 117 108 irq_desc_t *desc = irq_desc + irq; 118 109 unsigned long flags; 110 + 111 + if (irq >= NR_IRQS) 112 + return; 119 113 120 114 spin_lock_irqsave(&desc->lock, flags); 121 115 switch (desc->depth) { ··· 174 162 struct irqaction *old, **p; 175 163 unsigned long flags; 176 164 int shared = 0; 165 + 166 + if (irq >= NR_IRQS) 167 + return -EINVAL; 177 168 178 169 if (desc->handler == &no_irq_type) 179 170 return -ENOSYS;