Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Apr 2008 15:17:22 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 140297 for review
Message-ID:  <200804201517.m3KFHMak042212@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=140297

Change 140297 by hselasky@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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804201517.m3KFHMak042212>