In the VIRTUAL_TTY macro, add a check to make sure that the result of
SC_DEV isn't NULL; if it is, evaluate to NULL and don't dereference NULL. Callers of VIRTUAL_TTY must already check for the result being NULL since si_tty can be NULL, so this should be safe. This fixes a panic when trying to switch to a different vty in an environment such as userconfig (-c option to the kernel). PR: 26508
This commit is contained in:
parent
2b73cf034b
commit
415285a250
@ -124,7 +124,8 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFLAG_RW, &enable_panic_key,
|
||||
|
||||
#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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user