[ cc'd to -stable since that's affected, too ]

Attempting to switch VTYs in userconfig mode will lead to a null
dereference in syscons.  I saw some messages about this on -current,
-stable, or -bugs recently, but I can't find them now.  This is pretty
easy to reproduce: simply boot the kernel with the -c flag
(userconfig), and press ALT+F2 (i386).  As far as I can tell, this
isn't a new bug.

The patch is also pretty trivial.  It just changes the VIRTUAL_TTY
macro not to blindly assume sc->dev[x] is a valid pointer.  It is safe
to have it "return" NULL because any code that uses it must (and does)
already check for that condition since si_tty may also be NULL in some
cases (or at least that's the way I understand it).

Could someone please look it over and, if it's okay, commit it?


                                        Dima Dorfman
                                        [EMAIL PROTECTED]

Index: syscons.c
RCS file: /st/src/FreeBSD/src/sys/dev/syscons/syscons.c,v
retrieving revision 1.355
diff -u -r1.355 syscons.c
--- syscons.c   2001/03/26 12:40:39     1.355
+++ syscons.c   2001/04/07 21:02:31
@@ -122,7 +122,8 @@
 #define SC_CONSOLECTL  255
-#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x))->si_tty)
+#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x)) != NULL ?        \
+       SC_DEV((sc), (x))->si_tty : NULL)
 static int             debugger;

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to