aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient/nfs_subs.c
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2008-02-09 20:13:19 +0000
committerAttilio Rao <attilio@FreeBSD.org>2008-02-09 20:13:19 +0000
commita3c14ce5d9b165386aac5d5914abc27d18b45294 (patch)
tree74cdba6a987c910d5ea437c85c039eb5d6ed8e62 /sys/nfsclient/nfs_subs.c
parentcf99a6bebb9c77c6b8e5a5bb6017ec462e0c2046 (diff)
downloadsrc-a3c14ce5d9b165386aac5d5914abc27d18b45294.tar.gz
src-a3c14ce5d9b165386aac5d5914abc27d18b45294.zip
namei() can call underlying nfs_readlink() passing a struct uio pointer
owned by a NULL owner. This will lead consequent VOP_ISLOCKED() present into nfs_upgrade_vnlock() to panic as it only acquire curthread now. Fix nfs_upgrade_vnlock() and nfs_downgrade_vnlock() in order to not use more the struct thread pointer passed as argument (as it is really nomore required there as vn_lock() and VOP_UNLOCK doesn't get the lock more). Using curthread, in place, doesn't get ambiguity as LK_EXCLOTHER should be handled as a "not locked" request by both functions. Reported by: kris Tested by: kris Reviewed by: ups
Notes
Notes: svn path=/head/; revision=176134
Diffstat (limited to 'sys/nfsclient/nfs_subs.c')
-rw-r--r--sys/nfsclient/nfs_subs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index 881b1a11f065..f8cefb51c9e6 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -480,11 +480,11 @@ nfs_dircookie_unlock(struct nfsnode *np)
}
int
-nfs_upgrade_vnlock(struct vnode *vp, struct thread *td)
+nfs_upgrade_vnlock(struct vnode *vp)
{
int old_lock;
- if ((old_lock = VOP_ISLOCKED(vp, td)) != LK_EXCLUSIVE) {
+ if ((old_lock = VOP_ISLOCKED(vp, curthread)) != LK_EXCLUSIVE) {
if (old_lock == LK_SHARED) {
/* Upgrade to exclusive lock, this might block */
vn_lock(vp, LK_UPGRADE | LK_RETRY);
@@ -496,7 +496,7 @@ nfs_upgrade_vnlock(struct vnode *vp, struct thread *td)
}
void
-nfs_downgrade_vnlock(struct vnode *vp, struct thread *td, int old_lock)
+nfs_downgrade_vnlock(struct vnode *vp, int old_lock)
{
if (old_lock != LK_EXCLUSIVE) {
if (old_lock == LK_SHARED) {