diff options
-rw-r--r-- | fs/exec.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -878,9 +878,11 @@ static int de_thread(struct task_struct *tsk) | |||
878 | sig->notify_count--; | 878 | sig->notify_count--; |
879 | 879 | ||
880 | while (sig->notify_count) { | 880 | while (sig->notify_count) { |
881 | __set_current_state(TASK_UNINTERRUPTIBLE); | 881 | __set_current_state(TASK_KILLABLE); |
882 | spin_unlock_irq(lock); | 882 | spin_unlock_irq(lock); |
883 | schedule(); | 883 | schedule(); |
884 | if (unlikely(__fatal_signal_pending(tsk))) | ||
885 | goto killed; | ||
884 | spin_lock_irq(lock); | 886 | spin_lock_irq(lock); |
885 | } | 887 | } |
886 | spin_unlock_irq(lock); | 888 | spin_unlock_irq(lock); |
@@ -898,9 +900,11 @@ static int de_thread(struct task_struct *tsk) | |||
898 | write_lock_irq(&tasklist_lock); | 900 | write_lock_irq(&tasklist_lock); |
899 | if (likely(leader->exit_state)) | 901 | if (likely(leader->exit_state)) |
900 | break; | 902 | break; |
901 | __set_current_state(TASK_UNINTERRUPTIBLE); | 903 | __set_current_state(TASK_KILLABLE); |
902 | write_unlock_irq(&tasklist_lock); | 904 | write_unlock_irq(&tasklist_lock); |
903 | schedule(); | 905 | schedule(); |
906 | if (unlikely(__fatal_signal_pending(tsk))) | ||
907 | goto killed; | ||
904 | } | 908 | } |
905 | 909 | ||
906 | /* | 910 | /* |
@@ -994,6 +998,14 @@ no_thread_group: | |||
994 | 998 | ||
995 | BUG_ON(!thread_group_leader(tsk)); | 999 | BUG_ON(!thread_group_leader(tsk)); |
996 | return 0; | 1000 | return 0; |
1001 | |||
1002 | killed: | ||
1003 | /* protects against exit_notify() and __exit_signal() */ | ||
1004 | read_lock(&tasklist_lock); | ||
1005 | sig->group_exit_task = NULL; | ||
1006 | sig->notify_count = 0; | ||
1007 | read_unlock(&tasklist_lock); | ||
1008 | return -EAGAIN; | ||
997 | } | 1009 | } |
998 | 1010 | ||
999 | char *get_task_comm(char *buf, struct task_struct *tsk) | 1011 | char *get_task_comm(char *buf, struct task_struct *tsk) |