svn commit: r276727 - head/sys/kern
Mark Johnston
markj at FreeBSD.org
Mon Jan 5 23:07:23 UTC 2015
Author: markj
Date: Mon Jan 5 23:07:22 2015
New Revision: 276727
URL: https://svnweb.freebsd.org/changeset/base/276727
Log:
Use crcopysafe(9) to make a copy of a process' credential struct. crcopy(9)
may perform a blocking memory allocation, which is unsafe when holding a
mutex.
Differential Revision: https://reviews.freebsd.org/D1443
Reviewed by: rwatson
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Modified:
head/sys/kern/sys_capability.c
Modified: head/sys/kern/sys_capability.c
==============================================================================
--- head/sys/kern/sys_capability.c Mon Jan 5 21:39:35 2015 (r276726)
+++ head/sys/kern/sys_capability.c Mon Jan 5 23:07:22 2015 (r276727)
@@ -102,8 +102,7 @@ sys_cap_enter(struct thread *td, struct
newcred = crget();
p = td->td_proc;
PROC_LOCK(p);
- oldcred = p->p_ucred;
- crcopy(newcred, oldcred);
+ oldcred = crcopysafe(p, newcred);
newcred->cr_flags |= CRED_FLAG_CAPMODE;
p->p_ucred = newcred;
PROC_UNLOCK(p);
More information about the svn-src-head
mailing list