svn commit: r295392 - stable/10/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Mon Feb 8 11:15:37 UTC 2016
Author: kib
Date: Mon Feb 8 11:15:36 2016
New Revision: 295392
URL: https://svnweb.freebsd.org/changeset/base/295392
Log:
MFC r294735:
Don't allow opening the callout device when the callin device is already
open (in disguise as the console device).
Approved by: re (gjb)
Modified:
stable/10/sys/kern/tty.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/kern/tty.c
==============================================================================
--- stable/10/sys/kern/tty.c Mon Feb 8 10:54:27 2016 (r295391)
+++ stable/10/sys/kern/tty.c Mon Feb 8 11:15:36 2016 (r295392)
@@ -266,10 +266,10 @@ ttydev_open(struct cdev *dev, int oflags
/*
* Make sure the "tty" and "cua" device cannot be opened at the
- * same time.
+ * same time. The console is a "tty" device.
*/
if (TTY_CALLOUT(tp, dev)) {
- if (tp->t_flags & TF_OPENED_IN) {
+ if (tp->t_flags & (TF_OPENED_CONS | TF_OPENED_IN)) {
error = EBUSY;
goto done;
}
@@ -322,6 +322,8 @@ ttydev_open(struct cdev *dev, int oflags
tp->t_flags |= TF_OPENED_OUT;
else
tp->t_flags |= TF_OPENED_IN;
+ MPASS((tp->t_flags & (TF_OPENED_CONS | TF_OPENED_IN)) == 0 ||
+ (tp->t_flags & TF_OPENED_OUT) == 0);
done: tp->t_flags &= ~TF_OPENCLOSE;
cv_broadcast(&tp->t_dcdwait);
@@ -342,7 +344,8 @@ ttydev_close(struct cdev *dev, int fflag
* Don't actually close the device if it is being used as the
* console.
*/
- MPASS((tp->t_flags & TF_OPENED) != TF_OPENED);
+ MPASS((tp->t_flags & (TF_OPENED_CONS | TF_OPENED_IN)) == 0 ||
+ (tp->t_flags & TF_OPENED_OUT) == 0);
if (dev == dev_console)
tp->t_flags &= ~TF_OPENED_CONS;
else
More information about the svn-src-stable
mailing list