diff options
author | Andrew Morton <akpm@osdl.org> | 2006-06-28 07:26:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-28 17:59:02 -0400 |
commit | a052b68b1e7a31f1e6a721290035e9deb0f6fed9 (patch) | |
tree | cb7ea2ae023d22a49bb609afc74238b21d2e5983 | |
parent | 79bc79b07c9c6f8ae9290704e9e503a9327fcbb2 (diff) |
[PATCH] x86: do_IRQ(): check irq number
We recently changed x86 to handle more than 256 IRQs. Add a check in do_IRQ()
just to make sure that nothing went wrong with that implementation.
[chrisw@sous-sol.org: do x86_64 too]
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@muc.de>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: "Protasevich, Natalie" <Natalie.Protasevich@UNISYS.com>
Cc: <Christian.Limpach@cl.cam.ac.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/i386/kernel/irq.c | 6 | ||||
-rw-r--r-- | arch/x86_64/kernel/irq.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c index c703bc7b0880..9eec9435318e 100644 --- a/arch/i386/kernel/irq.c +++ b/arch/i386/kernel/irq.c | |||
@@ -60,6 +60,12 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs) | |||
60 | u32 *isp; | 60 | u32 *isp; |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | if (unlikely((unsigned)irq >= NR_IRQS)) { | ||
64 | printk(KERN_EMERG "%s: cannot handle IRQ %d\n", | ||
65 | __FUNCTION__, irq); | ||
66 | BUG(); | ||
67 | } | ||
68 | |||
63 | irq_enter(); | 69 | irq_enter(); |
64 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 70 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
65 | /* Debugging check for stack overflow: is there less than 1KB free? */ | 71 | /* Debugging check for stack overflow: is there less than 1KB free? */ |
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c index 3be0a7e4bf08..bfa82f52a5cc 100644 --- a/arch/x86_64/kernel/irq.c +++ b/arch/x86_64/kernel/irq.c | |||
@@ -118,6 +118,12 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) | |||
118 | /* high bit used in ret_from_ code */ | 118 | /* high bit used in ret_from_ code */ |
119 | unsigned irq = ~regs->orig_rax; | 119 | unsigned irq = ~regs->orig_rax; |
120 | 120 | ||
121 | if (unlikely(irq >= NR_IRQS)) { | ||
122 | printk(KERN_EMERG "%s: cannot handle IRQ %d\n", | ||
123 | __FUNCTION__, irq); | ||
124 | BUG(); | ||
125 | } | ||
126 | |||
121 | exit_idle(); | 127 | exit_idle(); |
122 | irq_enter(); | 128 | irq_enter(); |
123 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 129 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |