summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
authormini <mini@FreeBSD.org>2002-07-11 02:18:33 +0000
committermini <mini@FreeBSD.org>2002-07-11 02:18:33 +0000
commitb244d01c4d1f0d892a66a78485850cf28a6db242 (patch)
tree998c964f1dba7a37a9c8f3efc2c0d6275c26d219 /sys/kern/kern_prot.c
parent88b937fe29c8492a2cb68b853f5aef5cbdb23c1f (diff)
downloadFreeBSD-src-b244d01c4d1f0d892a66a78485850cf28a6db242.zip
FreeBSD-src-b244d01c4d1f0d892a66a78485850cf28a6db242.tar.gz
Revert removal of cred_free_thread(): It is used to ensure that a thread's
credentials are not improperly borrowed when the thread is not current in the kernel. Requested by: jhb, alfred
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 3ddd286..8f85803 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1765,6 +1765,19 @@ crdup(struct ucred *cr)
return (newcr);
}
+#ifdef DIAGNOSTIC
+void
+cred_free_thread(struct thread *td)
+{
+ struct ucred *cred;
+
+ cred = td->td_ucred;
+ td->td_ucred = NULL;
+ if (cred != NULL)
+ crfree(cred);
+}
+#endif
+
/*
* Fill in a struct xucred based on a struct ucred.
*/
OpenPOWER on IntegriCloud