summaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-03-28 16:11:14 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 18:36:42 -0800
commit7001510d0cbf51ad202dd2d0744f54104285cbb9 (patch)
tree1df2a6930c460c12026231634b86d14b153a4a86 /kernel/fork.c
parenta9e88e84b5245da0a1dadb6ccca70ae84e93ccf6 (diff)
downloadlinux-7001510d0cbf51ad202dd2d0744f54104285cbb9.tar.gz
linux-7001510d0cbf51ad202dd2d0744f54104285cbb9.tar.bz2
linux-7001510d0cbf51ad202dd2d0744f54104285cbb9.zip
[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/fork.c')
-rw-r--r--kernel/fork.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 33ffb5bf0dbc..8a46ad52be8f 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1208,7 +1208,8 @@ bad_fork_cleanup_mm:
bad_fork_cleanup_signal:
exit_signal(p);
bad_fork_cleanup_sighand:
- exit_sighand(p);
+ if (p->sighand)
+ __exit_sighand(p);
bad_fork_cleanup_fs:
exit_fs(p); /* blocking */
bad_fork_cleanup_files: