Skip to content

Commit

Permalink
x86/irq: Do not dereference irq descriptor before checking it
Browse files Browse the repository at this point in the history
Having the IS_NULL_OR_ERR() check after dereferencing the pointer is
not really working well.

Move the dereference after the check.

Fixes: a782a7e 'x86/irq: Store irq descriptor in vector array'
Reported-and-tested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner committed Aug 28, 2015
1 parent b51aa1c commit a47d457
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/x86/kernel/irq_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,15 @@ void do_softirq_own_stack(void)

bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
{
unsigned int irq = irq_desc_get_irq(desc);
unsigned int irq;
int overflow;

overflow = check_stack_overflow();

if (IS_ERR_OR_NULL(desc))
return false;

irq = irq_desc_get_irq(desc);
if (user_mode(regs) || !execute_on_irq_stack(overflow, desc, irq)) {
if (unlikely(overflow))
print_stack_overflow();
Expand Down

0 comments on commit a47d457

Please sign in to comment.