Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern crfree(): add DIAGNOSTIC sanity check of cr_ref; un...
details: https://anonhg.NetBSD.org/src/rev/f6d6612f45bb
branches: trunk
changeset: 518277:f6d6612f45bb
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Tue Nov 27 07:30:03 2001 +0000
description:
crfree(): add DIAGNOSTIC sanity check of cr_ref; unfortunately, if the memory
is freed prematurely the check won't be triggered immediatelly, probably
since the memory is likely to be reused fast; but it _would_ be triggered
eventually
diffstat:
sys/kern/kern_prot.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r 5dcea8523c70 -r f6d6612f45bb sys/kern/kern_prot.c
--- a/sys/kern/kern_prot.c Tue Nov 27 05:42:24 2001 +0000
+++ b/sys/kern/kern_prot.c Tue Nov 27 07:30:03 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_prot.c,v 1.65 2001/11/12 15:25:14 lukem Exp $ */
+/* $NetBSD: kern_prot.c,v 1.66 2001/11/27 07:30:03 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.65 2001/11/12 15:25:14 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_prot.c,v 1.66 2001/11/27 07:30:03 jdolecek Exp $");
#include "opt_compat_43.h"
@@ -687,6 +687,15 @@
struct ucred *cr;
{
+#ifdef DIAGNOSTIC
+ /*
+ * This check is not too reliable - the memory is likely
+ * to be reused fast.
+ */
+ if (cr->cr_ref == 0)
+ panic("crfree: ucred already free");
+#endif
+
if (--cr->cr_ref == 0)
FREE((caddr_t)cr, M_CRED);
}
Home |
Main Index |
Thread Index |
Old Index