exec plug a redundant vref + vrele of the image vnode

This commit is contained in:
mjg 2015-07-14 00:43:08 +00:00
parent 2c8a153253
commit 1fc8c9c24b

View File

@ -600,9 +600,6 @@ interpret:
vn_lock(imgp->vp, LK_SHARED | LK_RETRY); 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 * For security and other reasons, signal handlers cannot
* be shared after an exec. The new process gets a copy of the old * be shared after an exec. The new process gets a copy of the old
@ -767,8 +764,8 @@ interpret:
} }
/* /*
* Store the vp for use in procfs. This vnode was referenced prior * Store the vp for use in procfs. This vnode was referenced by namei
* to locking the proc lock. * or fgetvp_exec.
*/ */
textvp = p->p_textvp; textvp = p->p_textvp;
p->p_textvp = binvp; p->p_textvp = binvp;
@ -850,8 +847,6 @@ done1:
*/ */
if (textvp != NULL) if (textvp != NULL)
vrele(textvp); vrele(textvp);
if (error != 0)
vrele(binvp);
#ifdef KTRACE #ifdef KTRACE
if (tracevp != NULL) if (tracevp != NULL)
vrele(tracevp); vrele(tracevp);
@ -877,7 +872,10 @@ exec_fail_dealloc:
NDFREE(&nd, NDF_ONLY_PNBUF); NDFREE(&nd, NDF_ONLY_PNBUF);
if (imgp->opened) if (imgp->opened)
VOP_CLOSE(imgp->vp, FREAD, td->td_ucred, td); 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) if (imgp->object != NULL)