Do not allow the SNPSTTY ioctl for the snoop device that has a tty

attached. Otherwise, the snp->snp_tty would be overwritten, while the
tty line discipline still set to the snpdisc. Then snplwrite() causes
panic because ttytosnp() cannot find the snp.

MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2007-12-03 14:02:27 +00:00
parent fb76e092de
commit 6ed4cfc05d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174219

View File

@ -502,6 +502,9 @@ snpioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags,
s = *(int *)data;
if (s < 0)
return (snp_down(snp));
if (snp->snp_tty != NULL)
return (EBUSY);
if (fget(td, s, &fp) != 0)
return (EINVAL);
if (fp->f_type != DTYPE_VNODE ||