- 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.
This commit is contained in:
John Baldwin 2003-04-17 22:26:53 +00:00
parent e674d80790
commit 69c4ee54ff

View File

@ -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);