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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to