summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-19 16:17:18 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-20 13:08:25 -0400
commit5ae67c4fee869c9b3c87b727a9ea511b6326b834 (patch)
tree68fe22b71462c6e13eff3a6d637b79371c77441e /fs/nfs/nfs4state.c
parentc4f1b62a4b50a01e8d820717906b674807ef9ca3 (diff)
downloadlinux-stable-5ae67c4fee869c9b3c87b727a9ea511b6326b834.tar.gz
linux-stable-5ae67c4fee869c9b3c87b727a9ea511b6326b834.tar.bz2
linux-stable-5ae67c4fee869c9b3c87b727a9ea511b6326b834.zip
NFSv4: It is not safe to dereference lsp->ls_state in release_lockowner
It is quite possible for the release_lockowner RPC call to race with the close RPC call, in which case, we cannot dereference lsp->ls_state in order to find the nfs_server. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 12b068f2ec91..0f43414eb25a 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -791,10 +791,8 @@ out_free:
return NULL;
}
-void nfs4_free_lock_state(struct nfs4_lock_state *lsp)
+void nfs4_free_lock_state(struct nfs_server *server, struct nfs4_lock_state *lsp)
{
- struct nfs_server *server = lsp->ls_state->owner->so_server;
-
ida_simple_remove(&server->lockowner_id, lsp->ls_seqid.owner_id);
nfs4_destroy_seqid_counter(&lsp->ls_seqid);
kfree(lsp);
@@ -828,7 +826,7 @@ static struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_
}
spin_unlock(&state->state_lock);
if (new != NULL)
- nfs4_free_lock_state(new);
+ nfs4_free_lock_state(state->owner->so_server, new);
return lsp;
}
@@ -853,7 +851,7 @@ void nfs4_put_lock_state(struct nfs4_lock_state *lsp)
if (nfs4_release_lockowner(lsp) == 0)
return;
}
- nfs4_free_lock_state(lsp);
+ nfs4_free_lock_state(lsp->ls_state->owner->so_server, lsp);
}
static void nfs4_fl_copy_lock(struct file_lock *dst, struct file_lock *src)