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): Must hold alldevs_lock to iterate dv_l...



details:   https://anonhg.NetBSD.org/src/rev/ae82359e5fb3
branches:  trunk
changeset: 1021647:ae82359e5fb3
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jun 12 12:14:13 2021 +0000

description:
autoconf(9): Must hold alldevs_lock to iterate dv_list on alldevs.

diffstat:

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

diffs (34 lines):

diff -r 7a8f03d1d830 -r ae82359e5fb3 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Sat Jun 12 12:14:03 2021 +0000
+++ b/sys/kern/subr_autoconf.c  Sat Jun 12 12:14:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.283 2021/06/12 12:13:51 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.284 2021/06/12 12:14:13 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -79,7 +79,7 @@
 #define        __SUBR_AUTOCONF_PRIVATE /* see <sys/device.h> */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.283 2021/06/12 12:13:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.284 2021/06/12 12:14:13 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2020,6 +2020,7 @@
         * after parents, we only need to search the latter part of
         * the list.)
         */
+       mutex_enter(&alldevs_lock);
        for (d = TAILQ_NEXT(dev, dv_list); d != NULL;
            d = TAILQ_NEXT(d, dv_list)) {
                if (d->dv_parent == dev && d->dv_del_gen == 0) {
@@ -2029,6 +2030,7 @@
                        panic("config_detach");
                }
        }
+       mutex_exit(&alldevs_lock);
 #endif
 
        /* notify the parent that the child is gone */



Home | Main Index | Thread Index | Old Index