Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Nov 2008 18:53:33 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184649 - head/sys/compat/linprocfs
Message-ID:  <200811041853.mA4IrXIV004781@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Nov  4 18:53:33 2008
New Revision: 184649
URL: http://svn.freebsd.org/changeset/base/184649

Log:
  Don't leak a reference on the /compat/linux vnode everytime
  the linprocfs 'mtab' file is read.
  
  MFC after:	1 month

Modified:
  head/sys/compat/linprocfs/linprocfs.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- head/sys/compat/linprocfs/linprocfs.c	Tue Nov  4 18:38:48 2008	(r184648)
+++ head/sys/compat/linprocfs/linprocfs.c	Tue Nov  4 18:53:33 2008	(r184649)
@@ -318,11 +318,13 @@ linprocfs_domtab(PFS_FILL_ARGS)
 	NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, linux_emul_path, td);
 	flep = NULL;
 	error = namei(&nd);
-	VFS_UNLOCK_GIANT(NDHASGIANT(&nd));
-	if (error != 0 || vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0)
-		lep = linux_emul_path;
-	else
-		lep = dlep;
+	lep = linux_emul_path;
+	if (error == 0) {
+		if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0)
+			lep = dlep;
+		vrele(nd.ni_vp);
+		VFS_UNLOCK_GIANT(NDHASGIANT(&nd));
+	}
 	lep_len = strlen(lep);
 
 	mtx_lock(&mountlist_mtx);



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