Commit c5e3d98c authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Linus Torvalds

[PATCH] alpha show_interrups() trashes argument

This is a bug found by cpminer.  The show_interrupts function reuses i as a
for loop counter, and therefore trashes its contents, which are needed
later.

(akpm: rename local `i' to `irq', use for_each_inline_cpu())
Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9a5e7339
...@@ -68,34 +68,32 @@ show_interrupts(struct seq_file *p, void *v) ...@@ -68,34 +68,32 @@ show_interrupts(struct seq_file *p, void *v)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
int j; int j;
#endif #endif
int i = *(loff_t *) v; int irq = *(loff_t *) v;
struct irqaction * action; struct irqaction * action;
unsigned long flags; unsigned long flags;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (i == 0) { if (irq == 0) {
seq_puts(p, " "); seq_puts(p, " ");
for (i = 0; i < NR_CPUS; i++) for_each_online_cpu(j)
if (cpu_online(i)) seq_printf(p, "CPU%d ", j);
seq_printf(p, "CPU%d ", i);
seq_putc(p, '\n'); seq_putc(p, '\n');
} }
#endif #endif
if (i < ACTUAL_NR_IRQS) { if (irq < ACTUAL_NR_IRQS) {
spin_lock_irqsave(&irq_desc[i].lock, flags); spin_lock_irqsave(&irq_desc[irq].lock, flags);
action = irq_desc[i].action; action = irq_desc[irq].action;
if (!action) if (!action)
goto unlock; goto unlock;
seq_printf(p, "%3d: ",i); seq_printf(p, "%3d: ", irq);
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
seq_printf(p, "%10u ", kstat_irqs(i)); seq_printf(p, "%10u ", kstat_irqs(irq));
#else #else
for (j = 0; j < NR_CPUS; j++) for_each_online_cpu(j)
if (cpu_online(j)) seq_printf(p, "%10u ", kstat_cpu(j).irqs[irq]);
seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
#endif #endif
seq_printf(p, " %14s", irq_desc[i].handler->typename); seq_printf(p, " %14s", irq_desc[irq].handler->typename);
seq_printf(p, " %c%s", seq_printf(p, " %c%s",
(action->flags & SA_INTERRUPT)?'+':' ', (action->flags & SA_INTERRUPT)?'+':' ',
action->name); action->name);
...@@ -108,13 +106,12 @@ show_interrupts(struct seq_file *p, void *v) ...@@ -108,13 +106,12 @@ show_interrupts(struct seq_file *p, void *v)
seq_putc(p, '\n'); seq_putc(p, '\n');
unlock: unlock:
spin_unlock_irqrestore(&irq_desc[i].lock, flags); spin_unlock_irqrestore(&irq_desc[irq].lock, flags);
} else if (i == ACTUAL_NR_IRQS) { } else if (irq == ACTUAL_NR_IRQS) {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
seq_puts(p, "IPI: "); seq_puts(p, "IPI: ");
for (i = 0; i < NR_CPUS; i++) for_each_online_cpu(j)
if (cpu_online(i)) seq_printf(p, "%10lu ", cpu_data[j].ipi_count);
seq_printf(p, "%10lu ", cpu_data[i].ipi_count);
seq_putc(p, '\n'); seq_putc(p, '\n');
#endif #endif
seq_printf(p, "ERR: %10lu\n", irq_err_count); seq_printf(p, "ERR: %10lu\n", irq_err_count);
...@@ -122,7 +119,6 @@ unlock: ...@@ -122,7 +119,6 @@ unlock:
return 0; return 0;
} }
/* /*
* handle_irq handles all normal device IRQ's (the special * handle_irq handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific * SMP cross-CPU interrupts have their own specific
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment