Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Apr 2010 08:58:18 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206395 - head/sys/kern
Message-ID:  <201004080858.o388wIHc070673@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004080858.o388wIHc070673>