Avoids races of high-level syscons code with the sckbdevent handler. --- sys/dev/syscons/syscons.c.orig 2008-09-23 11:46:45.000000000 +0400 +++ sys/dev/syscons/syscons.c 2008-09-23 12:16:32.000000000 +0400 @@ -1569,7 +1569,9 @@ scp->ts = save; s = spltty(); /* block sckbdevent and scrn_timer */ + mtx_lock(&Giant); sccnupdate(scp); + mtx_unlock(&Giant); splx(s); } @@ -1590,6 +1592,7 @@ int s = spltty(); /* block sckbdevent and scrn_timer while we poll */ int c; + mtx_lock(&Giant); /* assert(sc_console != NULL) */ /* @@ -1601,11 +1604,13 @@ sccnupdate(scp); if (fkeycp < fkey.len) { + mtx_unlock(&Giant); splx(s); return fkey.str[fkeycp++]; } if (scp->sc->kbd == NULL) { + mtx_unlock(&Giant); splx(s); return -1; } @@ -1628,6 +1633,7 @@ scp->kbd_mode = cur_mode; kbd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); kbd_disable(scp->sc->kbd); + mtx_unlock(&Giant); splx(s); switch (KEYFLAGS(c)) {