Avoid event counter re-insert in evcount_percpu()
authorvisa <visa@openbsd.org>
Mon, 5 Dec 2022 08:58:49 +0000 (08:58 +0000)
committervisa <visa@openbsd.org>
Mon, 5 Dec 2022 08:58:49 +0000 (08:58 +0000)
This fixes evcount_list corruption that happened when evcount_percpu()
was called after evcount_init_percpu().

OK jca@ cheloha@ jmatthew@

sys/kern/subr_evcount.c

index cc9fc58..c77c953 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: subr_evcount.c,v 1.14 2022/11/10 07:05:41 jmatthew Exp $ */
+/*     $OpenBSD: subr_evcount.c,v 1.15 2022/12/05 08:58:49 visa Exp $ */
 /*
  * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
  * Copyright (c) 2004 Aaron Campbell <aaron@openbsd.org>
@@ -56,7 +56,6 @@ evcount_percpu(struct evcount *ec)
                TAILQ_INSERT_TAIL(&evcount_percpu_init_list, ec, next);
        } else {
                ec->ec_percpu = counters_alloc(1);
-               TAILQ_INSERT_TAIL(&evcount_list, ec, next);
        }
 }