summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_jail.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-04-17 22:26:53 +0000
committerjhb <jhb@FreeBSD.org>2003-04-17 22:26:53 +0000
commit08b81c369f074b87a2acdcfe29cc90467979838c (patch)
treef48d607c702f74c155de0b3358bc89175b89e859 /sys/kern/kern_jail.c
parent313b87d41a1d51ef3fe051877963244bd707f52d (diff)
downloadFreeBSD-src-08b81c369f074b87a2acdcfe29cc90467979838c.zip
FreeBSD-src-08b81c369f074b87a2acdcfe29cc90467979838c.tar.gz
- 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.
Diffstat (limited to 'sys/kern/kern_jail.c')
-rw-r--r--sys/kern/kern_jail.c4
1 files changed, 1 insertions, 3 deletions
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);
OpenPOWER on IntegriCloud