Commit 48a0b740 authored by Will Newton's avatar Will Newton Committed by Linus Torvalds

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: default avatarWill Newton <will.newton@gmail.com>
Cc: richard -rw- weinberger <richard.weinberger@gmail.com>
Acked-by: default avatarWANG Cong <xiyou.wangcong@gmail.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 94295e23
...@@ -821,12 +821,12 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty, ...@@ -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) static void unregister_winch(struct tty_struct *tty)
{ {
struct list_head *ele; struct list_head *ele, *next;
struct winch *winch; struct winch *winch;
spin_lock(&winch_handler_lock); 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); winch = list_entry(ele, struct winch, list);
if (winch->tty == tty) { if (winch->tty == tty) {
free_winch(winch, 1); free_winch(winch, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment