Module Name:    src
Committed By:   riastradh
Date:           Mon Mar 20 01:05:03 UTC 2017

Modified Files:
        src/sys/kern: subr_autoconf.c

Log Message:
Assert ownership of alldevs_mtx, as required for config_makeroom.

The one caller in config_unit_alloc guarantees ownership, via
config_alldevs_enter and preserved by config_makeroom.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/kern/subr_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.248 src/sys/kern/subr_autoconf.c:1.249
--- src/sys/kern/subr_autoconf.c:1.248	Mon Mar 20 00:30:03 2017
+++ src/sys/kern/subr_autoconf.c	Mon Mar 20 01:05:03 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.248 2017/03/20 00:30:03 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.249 2017/03/20 01:05:03 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.248 2017/03/20 00:30:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.249 2017/03/20 01:05:03 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1166,6 +1166,7 @@ config_makeroom(int n, struct cfdriver *
 	int ondevs, nndevs;
 	device_t *osp, *nsp;
 
+	KASSERT(mutex_owned(&alldevs_mtx));
 	alldevs_nwrite++;
 
 	for (nndevs = MAX(4, cd->cd_ndevs); nndevs <= n; nndevs += nndevs)
@@ -1209,6 +1210,7 @@ config_makeroom(int n, struct cfdriver *
 			mutex_enter(&alldevs_mtx);
 		}
 	}
+	KASSERT(mutex_owned(&alldevs_mtx));
 	alldevs_nwrite--;
 }
 

Reply via email to