Skip to content

Commit d2d9433

Browse files
stablebitsLinus Torvalds
authored andcommitted
kernel/irq/proc.c: unprotected iteration over the IRQ action list in name_unique()
setup_irq() releases a desc->lock before calling register_handler_proc(), so the iteration over the IRQ action list is not protected. (akpm: the check itself is still racy, but at least it probably won't oops now). Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c467a38 commit d2d9433

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎kernel/irq/proc.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,19 @@ static int name_unique(unsigned int irq, struct irqaction *new_action)
6666
{
6767
struct irq_desc *desc = irq_desc + irq;
6868
struct irqaction *action;
69+
unsigned long flags;
70+
int ret = 1;
6971

70-
for (action = desc->action ; action; action = action->next)
72+
spin_lock_irqsave(&desc->lock, flags);
73+
for (action = desc->action ; action; action = action->next) {
7174
if ((action != new_action) && action->name &&
72-
!strcmp(new_action->name, action->name))
73-
return 0;
74-
return 1;
75+
!strcmp(new_action->name, action->name)) {
76+
ret = 0;
77+
break;
78+
}
79+
}
80+
spin_unlock_irqrestore(&desc->lock, flags);
81+
return ret;
7582
}
7683

7784
void register_handler_proc(unsigned int irq, struct irqaction *action)

0 commit comments

Comments
 (0)