Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jul 2006 13:59:07 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 102456 for review
Message-ID:  <200607261359.k6QDx7dL022649@repoman.freebsd.org>

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

Change 102456 by hselasky@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) {



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