Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Nov 2014 22:17:26 +0000 (UTC)
From:      Bryan Venteicher <bryanv@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274063 - head/sys/dev/virtio/console
Message-ID:  <201411032217.sA3MHQSj056709@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bryanv
Date: Mon Nov  3 22:17:25 2014
New Revision: 274063
URL: https://svnweb.freebsd.org/changeset/base/274063

Log:
  Create the tty device after the port is completely initialized
  
  This fixes a race with a tty open before the host is the ready.
  
  MFC after:	1 month

Modified:
  head/sys/dev/virtio/console/virtio_console.c

Modified: head/sys/dev/virtio/console/virtio_console.c
==============================================================================
--- head/sys/dev/virtio/console/virtio_console.c	Mon Nov  3 21:26:11 2014	(r274062)
+++ head/sys/dev/virtio/console/virtio_console.c	Mon Nov  3 22:17:25 2014	(r274063)
@@ -1048,17 +1048,17 @@ vtcon_port_create(struct vtcon_softc *sc
 		return (error);
 	}
 
-	tty_makedev(port->vtcport_tty, NULL, "%s%r.%r", VTCON_TTY_PREFIX,
-	    device_get_unit(dev), id);
-
 	VTCON_LOCK(sc);
 	VTCON_PORT_LOCK(port);
-	vtcon_port_enable_intr(port);
 	scport->vcsp_port = port;
+	vtcon_port_enable_intr(port);
 	vtcon_port_submit_event(port, VIRTIO_CONSOLE_PORT_READY, 1);
 	VTCON_PORT_UNLOCK(port);
 	VTCON_UNLOCK(sc);
 
+	tty_makedev(port->vtcport_tty, NULL, "%s%r.%r", VTCON_TTY_PREFIX,
+	    device_get_unit(dev), id);
+
 	return (0);
 }
 



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