Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb ugen(4): Sprinkle KERNEL_LOCKED_P assertions aro...



details:   https://anonhg.NetBSD.org/src/rev/2b69710e4f8d
branches:  trunk
changeset: 985770:2b69710e4f8d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Sep 07 10:42:22 2021 +0000

description:
ugen(4): Sprinkle KERNEL_LOCKED_P assertions around sc_is_open.

diffstat:

 sys/dev/usb/ugen.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 89e08fc633d4 -r 2b69710e4f8d sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Tue Sep 07 10:09:34 2021 +0000
+++ b/sys/dev/usb/ugen.c        Tue Sep 07 10:42:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.158 2020/12/18 01:40:20 thorpej Exp $       */
+/*     $NetBSD: ugen.c,v 1.159 2021/09/07 10:42:22 riastradh Exp $     */
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.158 2020/12/18 01:40:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.159 2021/09/07 10:42:22 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -441,6 +441,8 @@
        DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n",
                    device_xname(sc->sc_dev), configno, sc));
 
+       KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
+
        if (chkopen) {
                /*
                 * We start at 1, not 0, because we don't care whether the
@@ -509,6 +511,8 @@
        int i, j;
        int error;
 
+       KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
+
        if ((sc = ugenif_acquire(unit)) == NULL)
                return ENXIO;
 
@@ -675,6 +679,8 @@
        int i;
        int error;
 
+       KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
+
        if ((sc = ugenif_acquire(UGENUNIT(dev))) == NULL)
                return ENXIO;
 
@@ -1530,6 +1536,8 @@
        int error;
        int dir;
 
+       KASSERT(KERNEL_LOCKED_P()); /* ugen_set_config */
+
        DPRINTFN(5, ("ugenioctl: cmd=%08lx\n", cmd));
 
        switch (cmd) {



Home | Main Index | Thread Index | Old Index