summaryrefslogtreecommitdiff
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
authorMarko Zec <zec@FreeBSD.org>2009-05-08 14:11:06 +0000
committerMarko Zec <zec@FreeBSD.org>2009-05-08 14:11:06 +0000
commit29b02909eb4d38a8803d0e125285c19c92e34da5 (patch)
tree070fe9c96176ed914dfefc12a45fea29b98c4122 /sys/kern/kern_prot.c
parentfcec7b25b83cce28458a932d1302235b13cf459e (diff)
Notes
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 9f13644f1528..b35f81f5316e 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socketvar.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
+#include <sys/vimage.h>
#if defined(INET) || defined(INET6)
#include <netinet/in.h>
@@ -1824,6 +1825,11 @@ crfree(struct ucred *cr)
*/
if (jailed(cr))
prison_free(cr->cr_prison);
+#ifdef VIMAGE
+ /* XXX TODO: find out why and when cr_vimage can be NULL here! */
+ if (cr->cr_vimage != NULL)
+ refcount_release(&cr->cr_vimage->vi_ucredrefc);
+#endif
#ifdef AUDIT
audit_cred_destroy(cr);
#endif
@@ -1859,6 +1865,10 @@ crcopy(struct ucred *dest, struct ucred *src)
uihold(dest->cr_ruidinfo);
if (jailed(dest))
prison_hold(dest->cr_prison);
+#ifdef VIMAGE
+ KASSERT(src->cr_vimage != NULL, ("cr_vimage == NULL"));
+ refcount_acquire(&dest->cr_vimage->vi_ucredrefc);
+#endif
#ifdef AUDIT
audit_cred_copy(src, dest);
#endif