]> err.no Git - linux-2.6/commit
[PATCH] copy_process: cleanup bad_fork_cleanup_signal
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 29 Mar 2006 00:11:16 +0000 (16:11 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 29 Mar 2006 02:36:42 +0000 (18:36 -0800)
commit6b3934ef52712ece50605dfc72e55d00c580831a
tree5ec3c4f69a20880f75de6ff8d7d2f67d96328df3
parent7001510d0cbf51ad202dd2d0744f54104285cbb9
[PATCH] copy_process: cleanup bad_fork_cleanup_signal

__exit_signal() does important cleanups atomically under ->siglock.  It is
also called from copy_process's error path.  This is not good, for example we
can't move __unhash_process() under ->siglock for that reason.

We should not mix these 2 paths, just look at ugly 'if (p->sighand)' under
'bad_fork_cleanup_sighand:' label.  For copy_process() case it is sufficient
to just backout copy_signal(), nothing more.

Again, nobody can see this task yet.  For CLONE_THREAD case we just decrement
signal->count, otherwise nobody can see this ->signal and we can free it
lockless.

This patch assumes it is safe to do exit_thread_group_keys() without
tasklist_lock.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/sched.h
include/linux/slab.h
kernel/fork.c
kernel/signal.c