PERFORCE change 140297 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sun Apr 20 15:17:23 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=140297

Change 140297 by hselasky at hselasky_laptop001 on 2008/04/20 15:16:57

	
	There is some USB code that depends on Giant
	being locked when "attach" is called, which
	should not depend on that.
	Fix this.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/ukbd.c#43 edit
.. //depot/projects/usb/src/sys/dev/usb/uvscom.c#39 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/ukbd.c#43 (text+ko) ====

@@ -704,15 +704,17 @@
 	if (bootverbose) {
 		genkbd_diag(kbd, bootverbose);
 	}
+	/* lock keyboard mutex */
+
+	mtx_lock(&Giant);
+
 	/* start the keyboard */
 
 	usbd_transfer_start(sc->sc_xfer[0]);
 
 	/* start the timer */
 
-	mtx_lock(&Giant);
-
-	ukbd_timeout(sc);
+	ukbd_timeout(sc);		/* will unlock mutex */
 
 	return (0);			/* success */
 

==== //depot/projects/usb/src/sys/dev/usb/uvscom.c#39 (text+ko) ====

@@ -365,8 +365,9 @@
 		goto detach;
 	}
 	/* start interrupt pipe */
-
+	mtx_lock(sc->sc_xfer[4]->priv_mtx);
 	usbd_transfer_start(sc->sc_xfer[4]);
+	mtx_unlock(sc->sc_xfer[4]->priv_mtx);
 
 	return (0);
 


More information about the p4-projects mailing list