Conditionally acquire Giant when dropping a reference on the ktrace vnode

during execve() when turning off tracing due to executing a setuid binary
as non-root.  Previously this could fail to acquire Giant and fail an
assertion if the ktrace file was on a non-MPSAFE filesystem and the
executable was on an MPSAFE filesystem.

MFC after:	3 days
Reported by:	kris
This commit is contained in:
jhb 2007-06-13 19:41:47 +00:00
parent 25f7638e33
commit 1c98f58fd2

View File

@ -736,8 +736,13 @@ done1:
if (ndp->ni_vp && error != 0)
vrele(ndp->ni_vp);
#ifdef KTRACE
if (tracevp != NULL)
if (tracevp != NULL) {
int tvfslocked;
tvfslocked = VFS_LOCK_GIANT(tracevp->v_mount);
vrele(tracevp);
VFS_UNLOCK_GIANT(tvfslocked);
}
if (tracecred != NULL)
crfree(tracecred);
#endif