From: Andrew Morton Attempt to avoid deadlocks and recursive oopses when the oops code calls do_exit(). Signed-off-by: Andrew Morton --- kernel/exit.c | 40 +++++++++++++++++++++++----------------- 1 files changed, 23 insertions(+), 17 deletions(-) diff -puN kernel/exit.c~exit-dont-call-sleeping-things-when-oopsing kernel/exit.c --- devel/kernel/exit.c~exit-dont-call-sleeping-things-when-oopsing 2006-04-28 01:04:57.000000000 -0700 +++ devel-akpm/kernel/exit.c 2006-04-28 01:10:38.000000000 -0700 @@ -845,7 +845,8 @@ fastcall NORET_TYPE void do_exit(long co struct task_struct *tsk = current; int group_dead; - profile_task_exit(tsk); + if (likely(!oops_in_progress)) + profile_task_exit(tsk); WARN_ON(atomic_read(&tsk->fs_excl)); @@ -898,7 +899,8 @@ fastcall NORET_TYPE void do_exit(long co if (group_dead) { hrtimer_cancel(&tsk->signal->real_timer); exit_itimers(tsk->signal); - acct_process(code); + if (likely(!oops_in_progress)) + acct_process(code); } if (unlikely(tsk->robust_list)) exit_robust_list(tsk); @@ -906,28 +908,32 @@ fastcall NORET_TYPE void do_exit(long co if (unlikely(tsk->compat_robust_list)) compat_exit_robust_list(tsk); #endif - if (unlikely(tsk->audit_context)) - audit_free(tsk); - exit_mm(tsk); - - exit_sem(tsk); - __exit_files(tsk); - __exit_fs(tsk); - exit_namespace(tsk); - exit_thread(); - cpuset_exit(tsk); - exit_keys(tsk); + if (likely(!oops_in_progress)) { + if (unlikely(tsk->audit_context)) + audit_free(tsk); + exit_mm(tsk); + + exit_sem(tsk); + __exit_files(tsk); + __exit_fs(tsk); + exit_namespace(tsk); + exit_thread(); + cpuset_exit(tsk); + exit_keys(tsk); - if (group_dead && tsk->signal->leader) - disassociate_ctty(1); + if (group_dead && tsk->signal->leader) + disassociate_ctty(1); + } module_put(task_thread_info(tsk)->exec_domain->module); if (tsk->binfmt) module_put(tsk->binfmt->module); tsk->exit_code = code; - proc_exit_connector(tsk); - exit_notify(tsk); + if (likely(!oops_in_progress)) { + proc_exit_connector(tsk); + exit_notify(tsk); + } #ifdef CONFIG_NUMA mpol_free(tsk->mempolicy); tsk->mempolicy = NULL; _