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)
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to