diff options
author | Oleg Nesterov <oleg@redhat.com> | 2010-05-26 23:43:15 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 18:12:46 +0200 |
commit | 4dec2a91fd7e8815d730afbfdcf085cbf53433ac (patch) | |
tree | cd33cc793abf532d4ca212d09c1e8d3154a8b530 /kernel/exit.c | |
parent | ia64: ptrace_attach_sync_user_rbs: avoid "task->signal != NULL" checks (diff) | |
download | linux-4dec2a91fd7e8815d730afbfdcf085cbf53433ac.tar.xz linux-4dec2a91fd7e8815d730afbfdcf085cbf53433ac.zip |
fork/exit: move tty_kref_put() outside of __cleanup_signal()
tty_kref_put() has two callsites in copy_process() paths,
1. if copy_process() suceeds it is called before we copy
signal->tty from parent
2. otherwise it is called from __cleanup_signal() under
bad_fork_cleanup_signal: label
In both cases tty_kref_put() is not right and unneeded because we don't
have the balancing tty_kref_get(). Fortunately, this is harmless because
this can only happen without CLONE_THREAD, and in this case signal->tty
must be NULL.
Remove tty_kref_put() from copy_process() and __cleanup_signal(), and
change another caller of __cleanup_signal(), __exit_signal(), to call
tty_kref_put() by hand.
I hope this change makes sense by itself, but it is also needed to make
->signal refcountable.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Acked-by: Roland McGrath <roland@redhat.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 4c70c377d21f..4a72f1753edb 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -149,6 +149,7 @@ static void __exit_signal(struct task_struct *tsk) * see account_group_exec_runtime(). */ task_rq_unlock_wait(tsk); + tty_kref_put(sig->tty); __cleanup_signal(sig); } } |