From 48a0b7404db9b83799e97a7d599fceb8df66bf59 Mon Sep 17 00:00:00 2001 From: Will Newton Date: Wed, 12 Jan 2011 16:59:26 -0800 Subject: [PATCH] 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 Cc: richard -rw- weinberger Acked-by: WANG Cong Cc: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/drivers/line.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 1664cce7b0ac..050e4ddbbb65 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -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); -- 2.20.1