diff options
author | emax <emax@FreeBSD.org> | 2008-11-16 22:39:04 +0000 |
---|---|---|
committer | emax <emax@FreeBSD.org> | 2008-11-16 22:39:04 +0000 |
commit | 6a8a52aa6da7e117fc37372477d24a949d8f0178 (patch) | |
tree | 91cd47cdb7b335897f2a2f86464ae5f9d0bb0195 /sys/dev | |
parent | 4edc1f94512e1211d5b1f230b9693ca50f823a53 (diff) | |
download | FreeBSD-src-6a8a52aa6da7e117fc37372477d24a949d8f0178.zip FreeBSD-src-6a8a52aa6da7e117fc37372477d24a949d8f0178.tar.gz |
More locking for syscons(4). This should prevent races with sckbdevent().
PR: kern/127446
Submitted by: Eygene Ryabinkin rea-fbsd at codelabs dot ru
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/syscons/syscons.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 37b08b6..90b5afa 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -1572,6 +1572,7 @@ sccngetch(int flags) int s = spltty(); /* block sckbdevent and scrn_timer while we poll */ int c; + mtx_lock(&Giant); /* assert(sc_console != NULL) */ /* @@ -1583,11 +1584,13 @@ sccngetch(int flags) 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; } @@ -1610,6 +1613,7 @@ sccngetch(int flags) scp->kbd_mode = cur_mode; kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); kbdd_disable(scp->sc->kbd); + mtx_unlock(&Giant); splx(s); switch (KEYFLAGS(c)) { |