svn commit: r206646 - stable/8/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Apr 15 08:17:28 UTC 2010


Author: kib
Date: Thu Apr 15 08:17:28 2010
New Revision: 206646
URL: http://svn.freebsd.org/changeset/base/206646

Log:
  MFC r206395:
  Do not leak master pty or ptmx vnode.

Modified:
  stable/8/sys/kern/tty_pts.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/tty_pts.c
==============================================================================
--- stable/8/sys/kern/tty_pts.c	Thu Apr 15 05:24:18 2010	(r206645)
+++ stable/8/sys/kern/tty_pts.c	Thu Apr 15 08:17:28 2010	(r206646)
@@ -589,6 +589,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