From 08b81c369f074b87a2acdcfe29cc90467979838c Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 17 Apr 2003 22:26:53 +0000 Subject: - The prison mutex cannot possibly protect pointers to the prison it protects, so don't bother locking it while we assign it to a ucred's cr_prison. - Fully construct the new credential for a process before assigning it to p_ucred. --- sys/kern/kern_jail.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sys/kern/kern_jail.c') diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index c4b1c94..1dd019f 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -218,10 +218,8 @@ jail_attach(td, uap) oldcred = p->p_ucred; setsugid(p); crcopy(newcred, oldcred); + newcred->cr_prison = pr; p->p_ucred = newcred; - mtx_lock(&pr->pr_mtx); - p->p_ucred->cr_prison = pr; - mtx_unlock(&pr->pr_mtx); PROC_UNLOCK(p); crfree(oldcred); return (0); -- cgit v1.1