diff options
author | Milton Miller <miltonm@bga.com> | 2011-05-24 16:34:18 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-05-25 23:38:59 -0400 |
commit | 2e455257d143f54b44701e947a092d513889d01c (patch) | |
tree | 3ec9c640c1bce6b2ea78accc0b0b962f97595e0c /arch/powerpc | |
parent | 3d1b5e206a4f0ce46f2aa138590738c5d8e118ac (diff) |
powerpc/irq: Check desc in handle_one_irq and expand generic_handle_irq
Look up the descriptor and check that it is found in handle_one_irq
before checking if we are on the irq stack, and call the handler
directly using the descriptor if we are on the stack.
We need check irq_to_desc finds the descriptor to avoid a NULL
pointer dereference. It could have failed because the number from
ppc_md.get_irq was above NR_IRQS, or various exceptional conditions
with sparse irqs (eg race conditions while freeing an irq if its was
not shutdown in the controller).
fe12bc2c99 (genirq: Uninline and sanity check generic_handle_irq())
moved generic_handle_irq out of line to allow its use by interrupt
controllers in modules. However, handle_one_irq is core arch code.
It already knows the details of struct irq_desc and handling irqs in
the nested irq case. This will avoid the extra stack frame to return
the value we don't check.
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 0df255414836..ac4d29119f3e 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -295,17 +295,20 @@ static inline void handle_one_irq(unsigned int irq) | |||
295 | unsigned long saved_sp_limit; | 295 | unsigned long saved_sp_limit; |
296 | struct irq_desc *desc; | 296 | struct irq_desc *desc; |
297 | 297 | ||
298 | desc = irq_to_desc(irq); | ||
299 | if (!desc) | ||
300 | return; | ||
301 | |||
298 | /* Switch to the irq stack to handle this */ | 302 | /* Switch to the irq stack to handle this */ |
299 | curtp = current_thread_info(); | 303 | curtp = current_thread_info(); |
300 | irqtp = hardirq_ctx[smp_processor_id()]; | 304 | irqtp = hardirq_ctx[smp_processor_id()]; |
301 | 305 | ||
302 | if (curtp == irqtp) { | 306 | if (curtp == irqtp) { |
303 | /* We're already on the irq stack, just handle it */ | 307 | /* We're already on the irq stack, just handle it */ |
304 | generic_handle_irq(irq); | 308 | desc->handle_irq(irq, desc); |
305 | return; | 309 | return; |
306 | } | 310 | } |
307 | 311 | ||
308 | desc = irq_to_desc(irq); | ||
309 | saved_sp_limit = current->thread.ksp_limit; | 312 | saved_sp_limit = current->thread.ksp_limit; |
310 | 313 | ||
311 | irqtp->task = curtp->task; | 314 | irqtp->task = curtp->task; |