arch/um/drivers/line.c: safely iterate over list of winch handlers
authorWill Newton <will.newton@gmail.com>
Thu, 13 Jan 2011 00:59:26 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Jan 2011 16:03:07 +0000 (08:03 -0800)
unregister_winch() should use list_for_each_safe(), as it can delete from
the list.

Signed-off-by: Will Newton <will.newton@gmail.com>
Cc: richard -rw- weinberger <richard.weinberger@gmail.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/drivers/line.c

index 1664cce..050e4dd 100644 (file)
@@ -821,12 +821,12 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty,
 
 static void unregister_winch(struct tty_struct *tty)
 {
-       struct list_head *ele;
+       struct list_head *ele, *next;
        struct winch *winch;
 
        spin_lock(&winch_handler_lock);
 
-       list_for_each(ele, &winch_handlers) {
+       list_for_each_safe(ele, next, &winch_handlers) {
                winch = list_entry(ele, struct winch, list);
                if (winch->tty == tty) {
                        free_winch(winch, 1);