aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 0181b7b2281a..b01c5b04bcff 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -822,17 +822,17 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
822static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) 822static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
823{ 823{
824 struct signal_struct *sig; 824 struct signal_struct *sig;
825 int ret;
826 825
827 if (clone_flags & CLONE_THREAD) { 826 if (clone_flags & CLONE_THREAD) {
828 ret = thread_group_cputime_clone_thread(current); 827 atomic_inc(&current->signal->count);
829 if (likely(!ret)) { 828 atomic_inc(&current->signal->live);
830 atomic_inc(&current->signal->count); 829 return 0;
831 atomic_inc(&current->signal->live);
832 }
833 return ret;
834 } 830 }
835 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); 831 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
832
833 if (sig)
834 posix_cpu_timers_init_group(sig);
835
836 tsk->signal = sig; 836 tsk->signal = sig;
837 if (!sig) 837 if (!sig)
838 return -ENOMEM; 838 return -ENOMEM;
@@ -869,8 +869,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
869 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); 869 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
870 task_unlock(current->group_leader); 870 task_unlock(current->group_leader);
871 871
872 posix_cpu_timers_init_group(sig);
873
874 acct_init_pacct(&sig->pacct); 872 acct_init_pacct(&sig->pacct);
875 873
876 tty_audit_fork(sig); 874 tty_audit_fork(sig);
@@ -1013,6 +1011,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1013 * triggers too late. This doesn't hurt, the check is only there 1011 * triggers too late. This doesn't hurt, the check is only there
1014 * to stop root fork bombs. 1012 * to stop root fork bombs.
1015 */ 1013 */
1014 retval = -EAGAIN;
1016 if (nr_threads >= max_threads) 1015 if (nr_threads >= max_threads)
1017 goto bad_fork_cleanup_count; 1016 goto bad_fork_cleanup_count;
1018 1017