Skip to content

Commit

Permalink
arch/um/drivers/line.c: safely iterate over list of winch handlers
Browse files Browse the repository at this point in the history
unregister_winch() should use list_for_each_safe(), as it can delete from
the list.

Signed-off-by: Will Newton <[email protected]>
Cc: richard -rw- weinberger <[email protected]>
Acked-by: WANG Cong <[email protected]>
Cc: Jeff Dike <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
willnewton authored and torvalds committed Jan 13, 2011
1 parent 94295e2 commit 48a0b74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/um/drivers/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 48a0b74

Please sign in to comment.