Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Apr 2018 15:55:09 +0000 (UTC)
From:      "Jonathan T. Looney" <jtl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332831 - stable/11/sys/kern
Message-ID:  <201804201555.w3KFt9VF003153@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jtl
Date: Fri Apr 20 15:55:09 2018
New Revision: 332831
URL: https://svnweb.freebsd.org/changeset/base/332831

Log:
  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.

Modified:
  stable/11/sys/kern/subr_terminal.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/subr_terminal.c
==============================================================================
--- stable/11/sys/kern/subr_terminal.c	Fri Apr 20 15:48:50 2018	(r332830)
+++ stable/11/sys/kern/subr_terminal.c	Fri Apr 20 15:55:09 2018	(r332831)
@@ -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);
 }
 
 /*



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