Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern autoconf(9): Assert alldevs_lock held in config_uni...



details:   https://anonhg.NetBSD.org/src/rev/6feb0ec65322
branches:  trunk
changeset: 374272:6feb0ec65322
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 16 11:18:25 2023 +0000

description:
autoconf(9): Assert alldevs_lock held in config_unit_nextfree.

The one caller, config_unit_alloc, guarantees it through
config_alldevs_enter/exit.

diffstat:

 sys/kern/subr_autoconf.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 7add57e4572e -r 6feb0ec65322 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Sun Apr 16 11:14:58 2023 +0000
+++ b/sys/kern/subr_autoconf.c  Sun Apr 16 11:18:25 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.308 2023/04/16 11:14:58 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.309 2023/04/16 11:18:25 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.308 2023/04/16 11:14:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.309 2023/04/16 11:18:25 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1483,6 +1483,8 @@ config_unit_nextfree(cfdriver_t cd, cfda
 {
        int unit = cf->cf_unit;
 
+       KASSERT(mutex_owned(&alldevs_lock));
+
        if (unit < 0)
                return -1;
        if (cf->cf_fstate == FSTATE_STAR) {



Home | Main Index | Thread Index | Old Index