aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-02 10:24:56 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:38 -0400
commit27b3f949b769a208e2849d28e7ad64cadac5d0e3 (patch)
tree68b7f71e253ab76a4dbc916695a3b78e8c2a6e68 /fs/nfs/nfs4state.c
parent587142f85f796cf0b823dd3080e815f02ff6b952 (diff)
NFSv4: Fix a credential reference leak in nfs4_get_state_owner()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 5d7ffbfc348..0030248d63e 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -83,7 +83,7 @@ nfs4_client_grab_unused(struct nfs_client *clp, struct rpc_cred *cred)
83 if (!list_empty(&clp->cl_unused)) { 83 if (!list_empty(&clp->cl_unused)) {
84 sp = list_entry(clp->cl_unused.next, struct nfs4_state_owner, so_list); 84 sp = list_entry(clp->cl_unused.next, struct nfs4_state_owner, so_list);
85 atomic_inc(&sp->so_count); 85 atomic_inc(&sp->so_count);
86 sp->so_cred = cred; 86 sp->so_cred = get_rpccred(cred);
87 list_move(&sp->so_list, &clp->cl_state_owners); 87 list_move(&sp->so_list, &clp->cl_state_owners);
88 clp->cl_nunused--; 88 clp->cl_nunused--;
89 } 89 }
@@ -175,7 +175,6 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
175 struct nfs_client *clp = server->nfs_client; 175 struct nfs_client *clp = server->nfs_client;
176 struct nfs4_state_owner *sp, *new; 176 struct nfs4_state_owner *sp, *new;
177 177
178 get_rpccred(cred);
179 new = nfs4_alloc_state_owner(); 178 new = nfs4_alloc_state_owner();
180 spin_lock(&clp->cl_lock); 179 spin_lock(&clp->cl_lock);
181 sp = nfs4_find_state_owner(clp, cred); 180 sp = nfs4_find_state_owner(clp, cred);
@@ -185,7 +184,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
185 list_add(&new->so_list, &clp->cl_state_owners); 184 list_add(&new->so_list, &clp->cl_state_owners);
186 new->so_client = clp; 185 new->so_client = clp;
187 new->so_id = nfs4_alloc_lockowner_id(clp); 186 new->so_id = nfs4_alloc_lockowner_id(clp);
188 new->so_cred = cred; 187 new->so_cred = get_rpccred(cred);
189 sp = new; 188 sp = new;
190 new = NULL; 189 new = NULL;
191 } 190 }
@@ -193,7 +192,6 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
193 kfree(new); 192 kfree(new);
194 if (sp != NULL) 193 if (sp != NULL)
195 return sp; 194 return sp;
196 put_rpccred(cred);
197 return NULL; 195 return NULL;
198} 196}
199 197