Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jun 2016 21:35:19 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r302231 - stable/10/sys/kern
Message-ID:  <201606272135.u5RLZJxP024127@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Mon Jun 27 21:35:19 2016
New Revision: 302231
URL: https://svnweb.freebsd.org/changeset/base/302231

Log:
  MFC r285512:
  
    exec plug a redundant vref + vrele of the image vnode

Modified:
  stable/10/sys/kern/kern_exec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exec.c
==============================================================================
--- stable/10/sys/kern/kern_exec.c	Mon Jun 27 21:30:37 2016	(r302230)
+++ stable/10/sys/kern/kern_exec.c	Mon Jun 27 21:35:19 2016	(r302231)
@@ -613,9 +613,6 @@ interpret:
 
 	vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
 
-	/* Get a reference to the vnode prior to locking the proc */
-	VREF(binvp);
-
 	/*
 	 * For security and other reasons, signal handlers cannot
 	 * be shared after an exec. The new process gets a copy of the old
@@ -782,8 +779,8 @@ interpret:
 	}
 
 	/*
-	 * Store the vp for use in procfs.  This vnode was referenced prior
-	 * to locking the proc lock.
+	 * Store the vp for use in procfs.  This vnode was referenced by namei
+	 * or fgetvp_exec.
 	 */
 	textvp = p->p_textvp;
 	p->p_textvp = binvp;
@@ -865,8 +862,6 @@ done1:
 	 */
 	if (textvp != NULL)
 		vrele(textvp);
-	if (error != 0)
-		vrele(binvp);
 #ifdef KTRACE
 	if (tracevp != NULL)
 		vrele(tracevp);
@@ -892,7 +887,10 @@ exec_fail_dealloc:
 			NDFREE(&nd, NDF_ONLY_PNBUF);
 		if (imgp->opened)
 			VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td);
-		vput(imgp->vp);
+		if (error != 0)
+			vput(imgp->vp);
+		else
+			VOP_UNLOCK(imgp->vp, 0);
 	}
 
 	if (imgp->object != NULL)



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