aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-09-04 03:28:52 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-04 03:29:05 -0400
commit29e2035bddecce3eb584a8304528b50da8370a24 (patch)
tree13155df7d90a8e287b83a1cd6c0d02c3018212ab /kernel/fork.c
parent868489660dabc0c28087cca3dbc1adbbc398c6fe (diff)
parent37d0892c5a94e208cf863e3b7bac014edee4346d (diff)
Merge branch 'linus' into core/rcu
Merge reason: Avoid fuzz in init/main.c and update from rc6 to rc8. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 642e8b5edf00..637520ca0386 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -426,7 +426,6 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
426 init_rwsem(&mm->mmap_sem); 426 init_rwsem(&mm->mmap_sem);
427 INIT_LIST_HEAD(&mm->mmlist); 427 INIT_LIST_HEAD(&mm->mmlist);
428 mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; 428 mm->flags = (current->mm) ? current->mm->flags : default_dump_filter;
429 mm->oom_adj = (current->mm) ? current->mm->oom_adj : 0;
430 mm->core_state = NULL; 429 mm->core_state = NULL;
431 mm->nr_ptes = 0; 430 mm->nr_ptes = 0;
432 set_mm_counter(mm, file_rss, 0); 431 set_mm_counter(mm, file_rss, 0);
@@ -816,11 +815,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
816{ 815{
817 struct signal_struct *sig; 816 struct signal_struct *sig;
818 817
819 if (clone_flags & CLONE_THREAD) { 818 if (clone_flags & CLONE_THREAD)
820 atomic_inc(&current->signal->count);
821 atomic_inc(&current->signal->live);
822 return 0; 819 return 0;
823 }
824 820
825 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); 821 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
826 tsk->signal = sig; 822 tsk->signal = sig;
@@ -878,16 +874,6 @@ void __cleanup_signal(struct signal_struct *sig)
878 kmem_cache_free(signal_cachep, sig); 874 kmem_cache_free(signal_cachep, sig);
879} 875}
880 876
881static void cleanup_signal(struct task_struct *tsk)
882{
883 struct signal_struct *sig = tsk->signal;
884
885 atomic_dec(&sig->live);
886
887 if (atomic_dec_and_test(&sig->count))
888 __cleanup_signal(sig);
889}
890
891static void copy_flags(unsigned long clone_flags, struct task_struct *p) 877static void copy_flags(unsigned long clone_flags, struct task_struct *p)
892{ 878{
893 unsigned long new_flags = p->flags; 879 unsigned long new_flags = p->flags;
@@ -1237,6 +1223,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1237 } 1223 }
1238 1224
1239 if (clone_flags & CLONE_THREAD) { 1225 if (clone_flags & CLONE_THREAD) {
1226 atomic_inc(&current->signal->count);
1227 atomic_inc(&current->signal->live);
1240 p->group_leader = current->group_leader; 1228 p->group_leader = current->group_leader;
1241 list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); 1229 list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
1242 } 1230 }
@@ -1280,7 +1268,8 @@ bad_fork_cleanup_mm:
1280 if (p->mm) 1268 if (p->mm)
1281 mmput(p->mm); 1269 mmput(p->mm);
1282bad_fork_cleanup_signal: 1270bad_fork_cleanup_signal:
1283 cleanup_signal(p); 1271 if (!(clone_flags & CLONE_THREAD))
1272 __cleanup_signal(p->signal);
1284bad_fork_cleanup_sighand: 1273bad_fork_cleanup_sighand:
1285 __cleanup_sighand(p->sighand); 1274 __cleanup_sighand(p->sighand);
1286bad_fork_cleanup_fs: 1275bad_fork_cleanup_fs: