diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index c5c67267ef6f..b493702186eb 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1243,6 +1243,7 @@ crfree(cr) { mtx_lock(&cr->cr_mtx); + KASSERT(cr->cr_ref > 0, ("bad ucred refcount: %d", cr->cr_ref)); if (--cr->cr_ref == 0) { mtx_destroy(&cr->cr_mtx); /*