The attempt to rename "." with MAC framework compiled in would cause attempt

to twice unlock the vnode. Check that ni_vp and ni_dvp are different before
doing second unlock.

Reviewed by:	rwatson
Approved by:	pjd (mentor)
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2006-10-26 13:20:28 +00:00
parent ae4e9636ac
commit 9a969e626c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163703
2 changed files with 4 additions and 2 deletions

View File

@ -3270,7 +3270,8 @@ kern_rename(struct thread *td, char *from, char *to, enum uio_seg pathseg)
error = mac_check_vnode_rename_from(td->td_ucred, fromnd.ni_dvp,
fromnd.ni_vp, &fromnd.ni_cnd);
VOP_UNLOCK(fromnd.ni_dvp, 0, td);
VOP_UNLOCK(fromnd.ni_vp, 0, td);
if (fromnd.ni_dvp != fromnd.ni_vp)
VOP_UNLOCK(fromnd.ni_vp, 0, td);
#endif
fvp = fromnd.ni_vp;
if (error == 0)

View File

@ -3270,7 +3270,8 @@ kern_rename(struct thread *td, char *from, char *to, enum uio_seg pathseg)
error = mac_check_vnode_rename_from(td->td_ucred, fromnd.ni_dvp,
fromnd.ni_vp, &fromnd.ni_cnd);
VOP_UNLOCK(fromnd.ni_dvp, 0, td);
VOP_UNLOCK(fromnd.ni_vp, 0, td);
if (fromnd.ni_dvp != fromnd.ni_vp)
VOP_UNLOCK(fromnd.ni_vp, 0, td);
#endif
fvp = fromnd.ni_vp;
if (error == 0)