linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel: move exit_task_work() past exit_notify()
@ 2013-04-12 19:27 Andrey Vagin
  2013-04-13 14:22 ` Oleg Nesterov
  0 siblings, 1 reply; 9+ messages in thread
From: Andrey Vagin @ 2013-04-12 19:27 UTC (permalink / raw)
  Cc: linux-kernel, Andrey Vagin, Andrew Morton, Eric W. Biederman,
	Al Viro, Oleg Nesterov, David Howells

exit_task_work() must be called after exit_notify, because
exit_task_namespaces() may release a file and fput() enqueues a work.

exit_notify
  exit_task_namespaces
    free_ipc_ns
      shm_destroy
        fput
          task_work_add

so if task works don't run after exit_notify(), a few files may leak.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
 kernel/exit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 60bc027..1d1129b 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -795,7 +795,6 @@ void do_exit(long code)
 	exit_shm(tsk);
 	exit_files(tsk);
 	exit_fs(tsk);
-	exit_task_work(tsk);
 	check_stack_usage();
 	exit_thread();
 
@@ -822,6 +821,7 @@ void do_exit(long code)
 	ptrace_put_breakpoints(tsk);
 
 	exit_notify(tsk, group_dead);
+	exit_task_work(tsk);
 #ifdef CONFIG_NUMA
 	task_lock(tsk);
 	mpol_put(tsk->mempolicy);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-06-14 13:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-12 19:27 [PATCH] kernel: move exit_task_work() past exit_notify() Andrey Vagin
2013-04-13 14:22 ` Oleg Nesterov
2013-04-13 15:54   ` [PATCH 0/1] (Was: kernel: move exit_task_work() past exit_notify()) Oleg Nesterov
2013-04-13 15:55     ` [PATCH 1/1] move exit_task_namespaces() outside of exit_notify() Oleg Nesterov
2013-04-14  1:52       ` Eric W. Biederman
2013-04-15  9:57       ` Andrey Wagin
2013-04-15 15:33         ` Oleg Nesterov
2013-06-13  9:24       ` Andrew Vagin
2013-06-14 13:19         ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).