aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-03-28 19:11:14 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 21:36:42 -0500
commit7001510d0cbf51ad202dd2d0744f54104285cbb9 (patch)
tree1df2a6930c460c12026231634b86d14b153a4a86 /kernel/signal.c
parenta9e88e84b5245da0a1dadb6ccca70ae84e93ccf6 (diff)
[PATCH] copy_process: cleanup bad_fork_cleanup_sighand
The only caller of exit_sighand(tsk) is copy_process's error path. We can call __exit_sighand() directly and kill exit_sighand(). This 'tsk' was not yet registered in pid_hash[] or init_task.tasks, it has no external references, nobody can see it, and IF (clone_flags & CLONE_SIGHAND) At least 'current' has a reference to ->sighand, this means atomic_dec_and_test(sighand->count) can't be true. ELSE Nobody can see this ->sighand, this means we can free it without any locking. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index c5b65aa4c2bc..1d7f4463c32d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -336,20 +336,6 @@ void __exit_sighand(struct task_struct *tsk)
336 kmem_cache_free(sighand_cachep, sighand); 336 kmem_cache_free(sighand_cachep, sighand);
337} 337}
338 338
339void exit_sighand(struct task_struct *tsk)
340{
341 write_lock_irq(&tasklist_lock);
342 rcu_read_lock();
343 if (tsk->sighand != NULL) {
344 struct sighand_struct *sighand = rcu_dereference(tsk->sighand);
345 spin_lock(&sighand->siglock);
346 __exit_sighand(tsk);
347 spin_unlock(&sighand->siglock);
348 }
349 rcu_read_unlock();
350 write_unlock_irq(&tasklist_lock);
351}
352
353/* 339/*
354 * This function expects the tasklist_lock write-locked. 340 * This function expects the tasklist_lock write-locked.
355 */ 341 */