svn commit: r206395 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Thu Apr 8 08:58:18 UTC 2010
Author: kib
Date: Thu Apr 8 08:58:18 2010
New Revision: 206395
URL: http://svn.freebsd.org/changeset/base/206395
Log:
Do not leak master pty or ptmx vnode.
Report and test case by: Petr Salinger <Petr.Salinger seznam cz>
Reviewed by: ed
MFC after: 1 week
Modified:
head/sys/kern/tty_pts.c
Modified: head/sys/kern/tty_pts.c
==============================================================================
--- head/sys/kern/tty_pts.c Thu Apr 8 07:45:42 2010 (r206394)
+++ head/sys/kern/tty_pts.c Thu Apr 8 08:58:18 2010 (r206395)
@@ -575,6 +575,15 @@ ptsdev_close(struct file *fp, struct thr
tty_lock(tp);
tty_rel_gone(tp);
+ /*
+ * Open of /dev/ptmx or /dev/ptyXX changes the type of file
+ * from DTYPE_VNODE to DTYPE_PTS. vn_open() increases vnode
+ * use count, we need to decrement it, and possibly do other
+ * required cleanup.
+ */
+ if (fp->f_vnode != NULL)
+ return (vnops.fo_close(fp, td));
+
return (0);
}
More information about the svn-src-all
mailing list