Module Name:    src
Committed By:   mrg
Date:           Fri Jul 19 04:17:35 UTC 2019

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

Log Message:
call ure_stop_locked(), not ure_stop(), from ure_init_locked() to
avoid locking botch.  fixes assert reported by sc.dying.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/if_ure.c
cvs rdiff -u -r1.232 -r1.233 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/if_ure.c
diff -u src/sys/dev/usb/if_ure.c:1.13 src/sys/dev/usb/if_ure.c:1.14
--- src/sys/dev/usb/if_ure.c:1.13	Fri Jun 28 01:57:43 2019
+++ src/sys/dev/usb/if_ure.c	Fri Jul 19 04:17:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.13 2019/06/28 01:57:43 mrg Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.14 2019/07/19 04:17:34 mrg Exp $	*/
 
 /*	$OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $	*/
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.13 2019/06/28 01:57:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.14 2019/07/19 04:17:34 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -116,6 +116,7 @@ static void	ure_ocp_reg_write(struct ure
 
 static int	ure_init(struct ifnet *);
 static void	ure_stop(struct ifnet *, int);
+static void	ure_stop_locked(struct ifnet *, int);
 static void	ure_start(struct ifnet *);
 static void	ure_reset(struct ure_softc *);
 static void	ure_miibus_statchg(struct ifnet *);
@@ -530,7 +531,7 @@ ure_init_locked(struct ifnet *ifp)
 
 	/* Cancel pending I/O. */
 	if (ifp->if_flags & IFF_RUNNING)
-		ure_stop(ifp, 1);
+		ure_stop_locked(ifp, 1);
 
 	/* Set MAC address. */
 	memset(eaddr, 0, sizeof(eaddr));

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.232 src/sys/dev/usb/usb_subr.c:1.233
--- src/sys/dev/usb/usb_subr.c:1.232	Sat Jul  6 08:00:19 2019
+++ src/sys/dev/usb/usb_subr.c	Fri Jul 19 04:17:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.232 2019/07/06 08:00:19 maxv Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.233 2019/07/19 04:17:34 mrg 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.232 2019/07/06 08:00:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.233 2019/07/19 04:17:34 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -113,6 +113,42 @@ usbd_errstr(usbd_status err)
 	}
 }
 
+#if 0
+int
+usbd_err_to_errno(usbd_status err)
+{
+	switch (err) {
+	case USBD_NORMAL_COMPLETION:
+	case USBD_IN_PROGRESS:
+		return 0;
+	case USBD_PENDING_REQUESTS:
+	case USBD_NOT_STARTED:
+		return EAGAIN;
+	case USBD_INVAL:
+		return EINVAL;
+	case USBD_NOMEM:
+		return ENOMEM;
+	case USBD_CANCELLED: // ?
+	case USBD_INTERRUPTED:
+		return EINTR;
+	case USBD_BAD_ADDRESS:
+		return EFAULT;
+	case USBD_IN_USE:
+	case USBD_NO_ADDR:
+		return EBUSY;
+	case USBD_TOO_DEEP:
+		return ENOSPC;
+	case USBD_NOT_CONFIGURED:
+		return ENXIO;
+	case USBD_TIMEOUT:
+	case USBD_STALLED:
+		return ETIMEDOUT;
+	default:
+		return EIO;
+	}
+}
+#endif
+
 usbd_status
 usbd_get_string_desc(struct usbd_device *dev, int sindex, int langid,
 		     usb_string_descriptor_t *sdesc, int *sizep)

Reply via email to