Module Name:    src
Committed By:   skrll
Date:           Thu Apr 21 15:42:56 UTC 2016

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

Log Message:
autoconf(9) requires the kernel_lock so take it while discovering new
devices.

PR/51081: calling ioctl while attaching wifi device causes a jump to NULL


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/sys/dev/usb/usb_subr.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/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.208 src/sys/dev/usb/usb_subr.c:1.209
--- src/sys/dev/usb/usb_subr.c:1.208	Thu Jan  7 07:59:08 2016
+++ src/sys/dev/usb/usb_subr.c	Thu Apr 21 15:42:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.208 2016/01/07 07:59:08 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.209 2016/04/21 15:42:56 skrll 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.208 2016/01/07 07:59:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.209 2016/04/21 15:42:56 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -861,8 +861,10 @@ usbd_attachwholedevice(device_t parent, 
 	dlocs[USBDEVIFCF_CONFIGURATION] = -1;
 	dlocs[USBDEVIFCF_INTERFACE] = -1;
 
+	KERNEL_LOCK(1, NULL);
 	dv = config_found_sm_loc(parent, "usbdevif", dlocs, &uaa, usbd_print,
 				 config_stdsubmatch);
+	KERNEL_UNLOCK_ONE(NULL);
 	if (dv) {
 		dev->subdevs = malloc(sizeof dv, M_USB, M_NOWAIT);
 		if (dev->subdevs == NULL)
@@ -939,8 +941,10 @@ usbd_attachinterfaces(device_t parent, u
 			    loc != uiaa.ifaceno)
 				continue;
 		}
+		KERNEL_LOCK(1, NULL);
 		dv = config_found_sm_loc(parent, "usbifif", ilocs, &uiaa,
 					 usbd_ifprint, config_stdsubmatch);
+		KERNEL_UNLOCK_ONE(NULL);
 		if (!dv)
 			continue;
 

Reply via email to