diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index ac8100e3088a..9b4e54ef0225 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -368,6 +368,8 @@ void fastcall __mmdrop(struct mm_struct *mm) | |||
368 | */ | 368 | */ |
369 | void mmput(struct mm_struct *mm) | 369 | void mmput(struct mm_struct *mm) |
370 | { | 370 | { |
371 | might_sleep(); | ||
372 | |||
371 | if (atomic_dec_and_test(&mm->mm_users)) { | 373 | if (atomic_dec_and_test(&mm->mm_users)) { |
372 | exit_aio(mm); | 374 | exit_aio(mm); |
373 | exit_mmap(mm); | 375 | exit_mmap(mm); |
@@ -623,6 +625,7 @@ out: | |||
623 | /* | 625 | /* |
624 | * Allocate a new files structure and copy contents from the | 626 | * Allocate a new files structure and copy contents from the |
625 | * passed in files structure. | 627 | * passed in files structure. |
628 | * errorp will be valid only when the returned files_struct is NULL. | ||
626 | */ | 629 | */ |
627 | static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) | 630 | static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) |
628 | { | 631 | { |
@@ -631,6 +634,7 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) | |||
631 | int open_files, size, i, expand; | 634 | int open_files, size, i, expand; |
632 | struct fdtable *old_fdt, *new_fdt; | 635 | struct fdtable *old_fdt, *new_fdt; |
633 | 636 | ||
637 | *errorp = -ENOMEM; | ||
634 | newf = alloc_files(); | 638 | newf = alloc_files(); |
635 | if (!newf) | 639 | if (!newf) |
636 | goto out; | 640 | goto out; |
@@ -744,7 +748,6 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk) | |||
744 | * break this. | 748 | * break this. |
745 | */ | 749 | */ |
746 | tsk->files = NULL; | 750 | tsk->files = NULL; |
747 | error = -ENOMEM; | ||
748 | newf = dup_fd(oldf, &error); | 751 | newf = dup_fd(oldf, &error); |
749 | if (!newf) | 752 | if (!newf) |
750 | goto out; | 753 | goto out; |
@@ -871,6 +874,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts | |||
871 | tsk->it_prof_expires = | 874 | tsk->it_prof_expires = |
872 | secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur); | 875 | secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur); |
873 | } | 876 | } |
877 | acct_init_pacct(&sig->pacct); | ||
874 | 878 | ||
875 | return 0; | 879 | return 0; |
876 | } | 880 | } |
@@ -989,13 +993,10 @@ static task_t *copy_process(unsigned long clone_flags, | |||
989 | if (put_user(p->pid, parent_tidptr)) | 993 | if (put_user(p->pid, parent_tidptr)) |
990 | goto bad_fork_cleanup; | 994 | goto bad_fork_cleanup; |
991 | 995 | ||
992 | p->proc_dentry = NULL; | ||
993 | |||
994 | INIT_LIST_HEAD(&p->children); | 996 | INIT_LIST_HEAD(&p->children); |
995 | INIT_LIST_HEAD(&p->sibling); | 997 | INIT_LIST_HEAD(&p->sibling); |
996 | p->vfork_done = NULL; | 998 | p->vfork_done = NULL; |
997 | spin_lock_init(&p->alloc_lock); | 999 | spin_lock_init(&p->alloc_lock); |
998 | spin_lock_init(&p->proc_lock); | ||
999 | 1000 | ||
1000 | clear_tsk_thread_flag(p, TIF_SIGPENDING); | 1001 | clear_tsk_thread_flag(p, TIF_SIGPENDING); |
1001 | init_sigpending(&p->pending); | 1002 | init_sigpending(&p->pending); |
@@ -1155,18 +1156,6 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1155 | } | 1156 | } |
1156 | 1157 | ||
1157 | if (clone_flags & CLONE_THREAD) { | 1158 | if (clone_flags & CLONE_THREAD) { |
1158 | /* | ||
1159 | * Important: if an exit-all has been started then | ||
1160 | * do not create this new thread - the whole thread | ||
1161 | * group is supposed to exit anyway. | ||
1162 | */ | ||
1163 | if (current->signal->flags & SIGNAL_GROUP_EXIT) { | ||
1164 | spin_unlock(¤t->sighand->siglock); | ||
1165 | write_unlock_irq(&tasklist_lock); | ||
1166 | retval = -EAGAIN; | ||
1167 | goto bad_fork_cleanup_namespace; | ||
1168 | } | ||
1169 | |||
1170 | p->group_leader = current->group_leader; | 1159 | p->group_leader = current->group_leader; |
1171 | list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); | 1160 | list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); |
1172 | 1161 | ||