提交 2e455257 编写于 作者: M Milton Miller 提交者: Benjamin Herrenschmidt

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).

fe12bc2c (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: NMilton Miller <miltonm@bga.com>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 3d1b5e20
...@@ -295,17 +295,20 @@ static inline void handle_one_irq(unsigned int irq) ...@@ -295,17 +295,20 @@ static inline void handle_one_irq(unsigned int irq)
unsigned long saved_sp_limit; unsigned long saved_sp_limit;
struct irq_desc *desc; struct irq_desc *desc;
desc = irq_to_desc(irq);
if (!desc)
return;
/* Switch to the irq stack to handle this */ /* Switch to the irq stack to handle this */
curtp = current_thread_info(); curtp = current_thread_info();
irqtp = hardirq_ctx[smp_processor_id()]; irqtp = hardirq_ctx[smp_processor_id()];
if (curtp == irqtp) { if (curtp == irqtp) {
/* We're already on the irq stack, just handle it */ /* We're already on the irq stack, just handle it */
generic_handle_irq(irq); desc->handle_irq(irq, desc);
return; return;
} }
desc = irq_to_desc(irq);
saved_sp_limit = current->thread.ksp_limit; saved_sp_limit = current->thread.ksp_limit;
irqtp->task = curtp->task; irqtp->task = curtp->task;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册