diff options
author | kib <kib@FreeBSD.org> | 2006-10-26 13:20:28 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2006-10-26 13:20:28 +0000 |
commit | 33638419eac25821429642d4f2e2b447836295d9 (patch) | |
tree | c9f267d2a6b98c409765669ebf2b9cdd0ab2f60f /sys | |
parent | d4be3ff6232ed7efab0672ae12c4c7a38236894a (diff) | |
download | FreeBSD-src-33638419eac25821429642d4f2e2b447836295d9.zip FreeBSD-src-33638419eac25821429642d4f2e2b447836295d9.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_extattr.c | 3 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 3 |
2 files changed, 4 insertions, 2 deletions
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) |