Module Name:    src
Committed By:   skrll
Date:           Thu Mar 17 07:59:45 UTC 2016

Modified Files:
        src/sys/dev/usb [nick-nhusb]: uhci.c

Log Message:
Protect read of isoc->next with bus lock


To generate a diff of this commit:
cvs rdiff -u -r1.264.4.66 -r1.264.4.67 src/sys/dev/usb/uhci.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.66 src/sys/dev/usb/uhci.c:1.264.4.67
--- src/sys/dev/usb/uhci.c:1.264.4.66	Sun Mar 13 08:09:00 2016
+++ src/sys/dev/usb/uhci.c	Thu Mar 17 07:59:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.4.66 2016/03/13 08:09:00 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.4.67 2016/03/17 07:59:45 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.66 2016/03/13 08:09:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.67 2016/03/17 07:59:45 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -3062,6 +3062,7 @@ uhci_device_isoc_enter(struct usbd_xfer 
 		printf("%s: overflow!\n", __func__);
 #endif
 
+	mutex_enter(&sc->sc_lock);
 	next = isoc->next;
 	if (next == -1) {
 		/* Not in use yet, schedule it a few frames ahead. */
@@ -3078,7 +3079,6 @@ uhci_device_isoc_enter(struct usbd_xfer 
 				     UHCI_TD_ACTIVE |
 				     UHCI_TD_IOS);
 	nframes = xfer->ux_nframes;
-	mutex_enter(&sc->sc_lock);
 	for (i = 0; i < nframes; i++) {
 		std = isoc->stds[next];
 		if (++next >= UHCI_VFRAMELIST_COUNT)

Reply via email to