Date: Thu, 15 Apr 2010 08:17:28 +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-8@freebsd.org Subject: svn commit: r206646 - stable/8/sys/kern Message-ID: <201004150817.o3F8HSjg039771@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004150817.o3F8HSjg039771>