summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjtl <jtl@FreeBSD.org>2018-04-20 15:55:09 +0000
committerjtl <jtl@FreeBSD.org>2018-04-20 15:55:09 +0000
commite9074b7d63488ef14b3cae8913e1d78f836d8013 (patch)
treede9561541b13eaa089bf9ab44ddbdccdc8116451 /sys/kern
parentb7da047215401d2fad18fb0c486cfc5ac5b3d77f (diff)
downloadFreeBSD-src-e9074b7d63488ef14b3cae8913e1d78f836d8013.zip
FreeBSD-src-e9074b7d63488ef14b3cae8913e1d78f836d8013.tar.gz
MFC r314116:
Fix a panic during boot caused by inadequate locking of some vt(4) driver data structures. vt_change_font() calls vtbuf_grow() to change some vt driver data structures. It uses TF_MUTE to prevent the console from trying to use those data structures while it changes them. During the early stage of the boot process, the vt driver's tc_done routine uses those data structures; however, it is currently called outside the TF_MUTE check. Move the tc_done routine inside the locked TF_MUTE check. PR: 217282 Sponsored by: Netflix, Inc.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_terminal.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/subr_terminal.c b/sys/kern/subr_terminal.c
index db42d38..484408e 100644
--- a/sys/kern/subr_terminal.c
+++ b/sys/kern/subr_terminal.c
@@ -400,7 +400,10 @@ termtty_outwakeup(struct tty *tp)
TERMINAL_UNLOCK_TTY(tm);
}
- tm->tm_class->tc_done(tm);
+ TERMINAL_LOCK_TTY(tm);
+ if (!(tm->tm_flags & TF_MUTE))
+ tm->tm_class->tc_done(tm);
+ TERMINAL_UNLOCK_TTY(tm);
if (flags & TF_BELL)
tm->tm_class->tc_bell(tm);
}
@@ -570,10 +573,9 @@ termcn_cnputc(struct consdev *cp, int c)
teken_set_curattr(&tm->tm_emulator, &kernel_message);
teken_input(&tm->tm_emulator, &cv, 1);
teken_set_curattr(&tm->tm_emulator, &backup);
+ tm->tm_class->tc_done(tm);
}
TERMINAL_UNLOCK_CONS(tm);
-
- tm->tm_class->tc_done(tm);
}
/*
OpenPOWER on IntegriCloud