Commit 48a0b7404db9b83799e97a7d599fceb8df66bf59
Committed by
Linus Torvalds
1 parent
94295e2305
Exists in
master
and in
7 other branches
arch/um/drivers/line.c: safely iterate over list of winch handlers
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>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
arch/um/drivers/line.c
... | ... | @@ -821,12 +821,12 @@ |
821 | 821 | |
822 | 822 | static void unregister_winch(struct tty_struct *tty) |
823 | 823 | { |
824 | - struct list_head *ele; | |
824 | + struct list_head *ele, *next; | |
825 | 825 | struct winch *winch; |
826 | 826 | |
827 | 827 | spin_lock(&winch_handler_lock); |
828 | 828 | |
829 | - list_for_each(ele, &winch_handlers) { | |
829 | + list_for_each_safe(ele, next, &winch_handlers) { | |
830 | 830 | winch = list_entry(ele, struct winch, list); |
831 | 831 | if (winch->tty == tty) { |
832 | 832 | free_winch(winch, 1); |