From a5a262c6db1cef9fd04b76bb9bbd03d73506d39a Mon Sep 17 00:00:00 2001 From: Bosko Milekic Date: Wed, 27 Oct 2004 21:19:35 +0000 Subject: [PATCH] Fix a INVARIANTS-only bug introduced in Revision 1.104: IF INVARIANTS is defined, and in the rare case that we have allocated some objects from the slab and at least one initializer on at least one of those objects failed, and we need to fail the allocation and push the uninitialized items back into the slab caches -- in that scenario, we would fail to [re]set the bucket cache's ub_bucket item references to NULL, which would eventually trigger a KASSERT. --- sys/vm/uma_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 569934b2519..68500390c91 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -2093,9 +2093,13 @@ uma_zalloc_bucket(uma_zone_t zone, int flags) if (i != bucket->ub_cnt) { int j; - for (j = i; j < bucket->ub_cnt; j++) + for (j = i; j < bucket->ub_cnt; j++) { uma_zfree_internal(zone, bucket->ub_bucket[j], NULL, SKIP_FINI); +#ifdef INVARIANTS + bucket->ub_bucket[j] = NULL; +#endif + } bucket->ub_cnt = i; } ZONE_LOCK(zone);