diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index f895c68798b6..d19e19a75847 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -530,9 +530,6 @@ exit1(struct thread *td, int rval, int signo) PROC_LOCK(p); p->p_xthread = td; - /* Tell the prison that we are gone. */ - prison_proc_free(p->p_ucred->cr_prison); - #ifdef KDTRACE_HOOKS /* * Tell the DTrace fasttrap provider about the exit if it @@ -603,6 +600,9 @@ exit1(struct thread *td, int rval, int signo) PROC_LOCK(p->p_pptr); sx_xunlock(&proctree_lock); + /* Tell the prison that we are gone. */ + prison_proc_free(p->p_ucred->cr_prison); + /* * The state PRS_ZOMBIE prevents other proesses from sending * signal to the process, to avoid memory leak, we free memory