From d2b28e078aa883e86b96e34390901edc4911bcec Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 11 Nov 2002 16:36:20 +0000 Subject: [PATCH] Correct an assertion in the code to traverse the list of locks to find an earlier acquired lock with the same witness as the lock currently being acquired. If we had released several earlier acquired locks after acquiring enough locks to require another lock_list_entry bucket in the lock list, then subsequent lock_list_entry buckets could contain only one lock instance in which case i would be zero. Reported by: Joel M. Baldwin --- sys/kern/subr_witness.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 8766bb911878..411703a1937b 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -666,7 +666,7 @@ witness_lock(struct lock_object *lock, int flags, const char *file, int line) if (i == 0 && lle->ll_next != NULL) { lle = lle->ll_next; i = lle->ll_count - 1; - MPASS(i != 0); + MPASS(i >= 0 && i < LOCK_NCHILDREN); } } while (i >= 0); if (i < 0) {