exec plug a redundant vref + vrele of the image vnode

This commit is contained in:
Mateusz Guzik 2015-07-14 00:43:08 +00:00
parent e94e50af1d
commit 853be5ffef

View File

@ -600,9 +600,6 @@ do_execve(td, args, mac_p)
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
@ -767,8 +764,8 @@ do_execve(td, args, mac_p)
}
/*
* 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;
@ -850,8 +847,6 @@ do_execve(td, args, mac_p)
*/
if (textvp != NULL)
vrele(textvp);
if (error != 0)
vrele(binvp);
#ifdef KTRACE
if (tracevp != NULL)
vrele(tracevp);
@ -877,7 +872,10 @@ do_execve(td, args, mac_p)
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)