Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Apr 2001 14:25:42 -0700
From:      Dima Dorfman <dima@unixfreak.org>
To:        current@freebsd.org
Cc:        stable@freebsd.org
Subject:   syscons panic in userconfig mode (with patch)
Message-ID:  <20010407212542.2418A3E09@bazooka.unixfreak.org>

next in thread | raw e-mail | index | archive | help
[ 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?

Thanks,

					Dima Dorfman
					dima@unixfreak.org


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 majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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