PERFORCE change 102456 for review

Hans Petter Selasky hselasky at FreeBSD.org
Wed Jul 26 13:59:08 UTC 2006


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

Change 102456 by hselasky at hselasky_mini_itx on 2006/07/26 13:58:20

	There is a big problem in the keyboard system:
	If scroll lock is pressed and "printf()" is called, the
	Giant lock must be acquired by "printf()" before 
	un-scroll-locking the keyboard by an IOCTL call.
	Hence that will cause a locking reversal problem,
	I see no other solution than to disable the IOCTL
	call, leaving the keyboard scroll-locked.

Affected files ...

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

Differences ...

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

@@ -1162,6 +1162,21 @@
 	struct ukbd_softc *sc = kbd->kb_data;
 	int i;
 
+	if (!mtx_owned(&Giant)) {
+	    /* XXX big problem: 
+	     * If scroll lock is pressed and
+	     * "printf()" is called, the CPU will 
+	     * get here, to un-scroll lock the 
+	     * keyboard. But if "printf()" acquires 
+	     * the "Giant" lock, there will be a 
+	     * locking order reversal problem, 
+	     * so the keyboard system must get 
+	     * out of "Giant" first, before
+	     * the CPU can proceed here ...
+	     */
+	    return EINVAL;
+	}
+
 	mtx_assert(&Giant, MA_OWNED);
 
 	switch (cmd) {


More information about the p4-projects mailing list