Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d2d9433a4c84c9e7ed78d633fdbffb35d5afda17
Commit:     d2d9433a4c84c9e7ed78d633fdbffb35d5afda17
Parent:     c467a388ae9f236c039d4d0f4c4be07c7deebe97
Author:     Dmitry Adamushko <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 00:27:31 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 8 11:15:05 2007 -0700

    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 <[EMAIL PROTECTED]>
    Cc: Thomas Gleixner <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/irq/proc.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 2db91eb..ddde0ef 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -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)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to