PERFORCE change 107405 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sat Oct 7 02:26:48 PDT 2006


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

Change 107405 by hselasky at hselasky_mini_itx on 2006/10/07 09:26:28

	Temporary workarounds to prevent the evident panic, when
	the keyboard layer is being called without Giant.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/ukbd.c#12 edit

Differences ...

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

@@ -869,6 +869,10 @@
 {
 	struct ukbd_softc *sc = kbd->kb_data;
 
+	if (!mtx_owned(&Giant)) {
+	    return 0; /* XXX */
+	}
+
 	mtx_assert(&Giant, MA_OWNED);
 
 	if (!KBD_IS_ACTIVE(kbd)) {
@@ -891,6 +895,10 @@
 {
 	struct ukbd_softc *sc = kbd->kb_data;
 
+	if (!mtx_owned(&Giant)) {
+	    return 0; /* XXX */
+	}
+
 	mtx_assert(&Giant, MA_OWNED);
 
 	if (!KBD_IS_ACTIVE(kbd)) {
@@ -915,6 +923,10 @@
 	u_int32_t scancode;
 #endif
 
+	if (!mtx_owned(&Giant)) {
+	    return -1; /* XXX */
+	}
+
 	mtx_assert(&Giant, MA_OWNED);
 
 #ifdef UKBD_EMULATE_ATSCANCODE
@@ -961,6 +973,9 @@
 #ifdef UKBD_EMULATE_ATSCANCODE
 	u_int32_t scancode;
 #endif
+	if (!mtx_owned(&Giant)) {
+	    return NOKEY; /* XXX */
+	}
 
 	mtx_assert(&Giant, MA_OWNED);
 
@@ -1272,6 +1287,10 @@
 {
 	struct ukbd_softc *sc = kbd->kb_data;
 
+	if (!mtx_owned(&Giant)) {
+	    return; /* XXX */
+	}
+
 	mtx_assert(&Giant, MA_OWNED);
 
 	sc->sc_flags &= ~(UKBD_FLAG_COMPOSE|UKBD_FLAG_POLLING);
@@ -1310,6 +1329,10 @@
 {
 	struct ukbd_softc *sc = kbd->kb_data;
 
+	if (!mtx_owned(&Giant)) {
+	    return 0; /* XXX */
+	}
+
 	mtx_assert(&Giant, MA_OWNED);
 
 	if (on) {


More information about the p4-projects mailing list