Commit f2ab6d88 authored by Jonathan Lim's avatar Jonathan Lim Committed by Linus Torvalds

Assign task_struct.exit_code before taskstats_exit()

taskstats.ac_exitcode is assigned to task_struct.exit_code in bacct_add_tsk()
through the following kernel function calls:

  do_exit()
    taskstats_exit()
      fill_pid()
        bacct_add_tsk()

The problem is that in do_exit(), task_struct.exit_code is set to 'code' only
after taskstats_exit() has been called.  So we need to move the assignment
before taskstats_exit().
Signed-off-by: default avatarJonathan Lim <jlim@sgi.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c24c55c7
...@@ -975,6 +975,7 @@ fastcall NORET_TYPE void do_exit(long code) ...@@ -975,6 +975,7 @@ fastcall NORET_TYPE void do_exit(long code)
if (unlikely(tsk->audit_context)) if (unlikely(tsk->audit_context))
audit_free(tsk); audit_free(tsk);
tsk->exit_code = code;
taskstats_exit(tsk, group_dead); taskstats_exit(tsk, group_dead);
exit_mm(tsk); exit_mm(tsk);
...@@ -996,7 +997,6 @@ fastcall NORET_TYPE void do_exit(long code) ...@@ -996,7 +997,6 @@ fastcall NORET_TYPE void do_exit(long code)
if (tsk->binfmt) if (tsk->binfmt)
module_put(tsk->binfmt->module); module_put(tsk->binfmt->module);
tsk->exit_code = code;
proc_exit_connector(tsk); proc_exit_connector(tsk);
exit_task_namespaces(tsk); exit_task_namespaces(tsk);
exit_notify(tsk); exit_notify(tsk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment