Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb add missing KERNEL_LOCK protection ...



details:   https://anonhg.NetBSD.org/src/rev/a64afc307a6d
branches:  trunk
changeset: 318583:a64afc307a6d
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Apr 30 05:04:34 2018 +0000
description:
add missing KERNEL_LOCK protection around autoconf calls.

Also replace NULL argument with curlwp for style.

diffstat:

 sys/dev/usb/usb_subr.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (66 lines):

diff -r bf4dbb9a0694 -r a64afc307a6d sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Mon Apr 30 04:17:27 2018 +0000
+++ b/sys/dev/usb/usb_subr.c    Mon Apr 30 05:04:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.223 2017/12/26 18:44:52 khorben Exp $   */
+/*     $NetBSD: usb_subr.c,v 1.224 2018/04/30 05:04:34 mlelstv Exp $   */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.223 2017/12/26 18:44:52 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.224 2018/04/30 05:04:34 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -858,7 +858,9 @@
        uaa.uaa_subclass = dd->bDeviceSubClass;
        uaa.uaa_proto = dd->bDeviceProtocol;
 
+       KERNEL_LOCK(1, curlwp);
        dv = config_found_ia(parent, "usbroothubif", &uaa, 0);
+       KERNEL_UNLOCK_ONE(curlwp);
        if (dv) {
                dev->ud_subdevs = kmem_alloc(sizeof(dv), KM_SLEEP);
                dev->ud_subdevs[0] = dv;
@@ -903,10 +905,10 @@
        dlocs[USBDEVIFCF_CONFIGURATION] = -1;
        dlocs[USBDEVIFCF_INTERFACE] = -1;
 
-       KERNEL_LOCK(1, NULL);
+       KERNEL_LOCK(1, curlwp);
        dv = config_found_sm_loc(parent, "usbdevif", dlocs, &uaa, usbd_print,
                                 config_stdsubmatch);
-       KERNEL_UNLOCK_ONE(NULL);
+       KERNEL_UNLOCK_ONE(curlwp);
        if (dv) {
                dev->ud_subdevs = kmem_alloc(sizeof(dv), KM_SLEEP);
                dev->ud_subdevs[0] = dv;
@@ -980,10 +982,10 @@
                            loc != uiaa.uiaa_ifaceno)
                                continue;
                }
-               KERNEL_LOCK(1, NULL);
+               KERNEL_LOCK(1, curlwp);
                dv = config_found_sm_loc(parent, "usbifif", ilocs, &uiaa,
                                         usbd_ifprint, config_stdsubmatch);
-               KERNEL_UNLOCK_ONE(NULL);
+               KERNEL_UNLOCK_ONE(curlwp);
                if (!dv)
                        continue;
 
@@ -1727,7 +1729,10 @@
                                continue;
                        strlcpy(subdevname, device_xname(subdev),
                            sizeof(subdevname));
-                       if ((rc = config_detach(subdev, flags)) != 0)
+                       KERNEL_LOCK(1, curlwp);
+                       rc = config_detach(subdev, flags);
+                       KERNEL_UNLOCK_ONE(curlwp);
+                       if (rc != 0)
                                return rc;
                        printf("%s: at %s", subdevname, hubname);
                        if (up->up_portno != 0)



Home | Main Index | Thread Index | Old Index