Skip to content

Commit

Permalink
kernel/irq/proc.c: unprotected iteration over the IRQ action list in …
Browse files Browse the repository at this point in the history
…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 <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
stablebits authored and Linus Torvalds committed May 8, 2007
1 parent c467a38 commit d2d9433
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions kernel/irq/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,19 @@ static int name_unique(unsigned int irq, struct irqaction *new_action)
{
struct irq_desc *desc = irq_desc + irq;
struct irqaction *action;
unsigned long flags;
int ret = 1;

for (action = desc->action ; action; action = action->next)
spin_lock_irqsave(&desc->lock, flags);
for (action = desc->action ; action; action = action->next) {
if ((action != new_action) && action->name &&
!strcmp(new_action->name, action->name))
return 0;
return 1;
!strcmp(new_action->name, action->name)) {
ret = 0;
break;
}
}
spin_unlock_irqrestore(&desc->lock, flags);
return ret;
}

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

0 comments on commit d2d9433

Please sign in to comment.