From 33638419eac25821429642d4f2e2b447836295d9 Mon Sep 17 00:00:00 2001 From: kib Date: Thu, 26 Oct 2006 13:20:28 +0000 Subject: 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 --- sys/kern/vfs_extattr.c | 3 ++- sys/kern/vfs_syscalls.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 81529f0..8a57786 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -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) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 81529f0..8a57786 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -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) -- cgit v1.1