Module Name:    src
Committed By:   riastradh
Date:           Tue Sep  7 10:42:22 UTC 2021

Modified Files:
        src/sys/dev/usb: ugen.c

Log Message:
ugen(4): Sprinkle KERNEL_LOCKED_P assertions around sc_is_open.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/usb/ugen.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/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.158 src/sys/dev/usb/ugen.c:1.159
--- src/sys/dev/usb/ugen.c:1.158	Fri Dec 18 01:40:20 2020
+++ src/sys/dev/usb/ugen.c	Tue Sep  7 10:42:22 2021
@@ -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 @@ ugen_set_config(struct ugen_softc *sc, i
 	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 @@ ugenopen(dev_t dev, int flag, int mode, 
 	int i, j;
 	int error;
 
+	KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
+
 	if ((sc = ugenif_acquire(unit)) == NULL)
 		return ENXIO;
 
@@ -675,6 +679,8 @@ ugenclose(dev_t dev, int flag, int mode,
 	int i;
 	int error;
 
+	KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
+
 	if ((sc = ugenif_acquire(UGENUNIT(dev))) == NULL)
 		return ENXIO;
 
@@ -1530,6 +1536,8 @@ ugen_do_ioctl(struct ugen_softc *sc, int
 	int error;
 	int dir;
 
+	KASSERT(KERNEL_LOCKED_P()); /* ugen_set_config */
+
 	DPRINTFN(5, ("ugenioctl: cmd=%08lx\n", cmd));
 
 	switch (cmd) {

Reply via email to