Date: Mon, 8 Feb 2016 11:15:36 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r295392 - stable/10/sys/kern Message-ID: <201602081115.u18BFat6059422@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602081115.u18BFat6059422>