Commit 45cd5e2d4e632f55af1d6131f33b554c98f8b929

Authored by Al Viro
Committed by Linus Torvalds
1 parent f71f94845e

um: winch_interrupt() can happen inside of free_winch()

...  so set winch->fd to -1 before doing free_irq(), to avoid having
winch_interrupt() come from/during the latter and attempt to do
reactivate_fd() on something that's already gone.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

arch/um/drivers/line.c
... ... @@ -725,6 +725,8 @@
725 725  
726 726 static void free_winch(struct winch *winch, int free_irq_ok)
727 727 {
  728 + int fd = winch->fd;
  729 + winch->fd = -1;
728 730 if (free_irq_ok)
729 731 free_irq(WINCH_IRQ, winch);
730 732  
... ... @@ -732,8 +734,8 @@
732 734  
733 735 if (winch->pid != -1)
734 736 os_kill_process(winch->pid, 1);
735   - if (winch->fd != -1)
736   - os_close_file(winch->fd);
  737 + if (fd != -1)
  738 + os_close_file(fd);
737 739 if (winch->stack != 0)
738 740 free_stack(winch->stack, 0);
739 741 kfree(winch);