提交 12de3b35 编写于 作者: T Trond Myklebust

SUNRPC: Ensure that rpc_mkpipe returns a refcounted dentry

If not, we cannot guarantee that idmap->idmap_dentry, gss_auth->dentry and
clnt->cl_dentry are valid dentries.
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 24c5d9d7
...@@ -132,6 +132,8 @@ nfs_idmap_delete(struct nfs4_client *clp) ...@@ -132,6 +132,8 @@ nfs_idmap_delete(struct nfs4_client *clp)
if (!idmap) if (!idmap)
return; return;
dput(idmap->idmap_dentry);
idmap->idmap_dentry = NULL;
rpc_unlink(idmap->idmap_path); rpc_unlink(idmap->idmap_path);
clp->cl_idmap = NULL; clp->cl_idmap = NULL;
kfree(idmap); kfree(idmap);
......
...@@ -721,6 +721,8 @@ gss_destroy(struct rpc_auth *auth) ...@@ -721,6 +721,8 @@ gss_destroy(struct rpc_auth *auth)
gss_auth = container_of(auth, struct gss_auth, rpc_auth); gss_auth = container_of(auth, struct gss_auth, rpc_auth);
rpc_unlink(gss_auth->path); rpc_unlink(gss_auth->path);
dput(gss_auth->dentry);
gss_auth->dentry = NULL;
gss_mech_put(gss_auth->mech); gss_mech_put(gss_auth->mech);
rpcauth_free_credcache(auth); rpcauth_free_credcache(auth);
......
...@@ -240,6 +240,7 @@ rpc_clone_client(struct rpc_clnt *clnt) ...@@ -240,6 +240,7 @@ rpc_clone_client(struct rpc_clnt *clnt)
new->cl_autobind = 0; new->cl_autobind = 0;
new->cl_oneshot = 0; new->cl_oneshot = 0;
new->cl_dead = 0; new->cl_dead = 0;
dget(new->cl_dentry);
rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval);
if (new->cl_auth) if (new->cl_auth)
atomic_inc(&new->cl_auth->au_count); atomic_inc(&new->cl_auth->au_count);
...@@ -314,6 +315,8 @@ rpc_destroy_client(struct rpc_clnt *clnt) ...@@ -314,6 +315,8 @@ rpc_destroy_client(struct rpc_clnt *clnt)
if (clnt->cl_server != clnt->cl_inline_name) if (clnt->cl_server != clnt->cl_inline_name)
kfree(clnt->cl_server); kfree(clnt->cl_server);
out_free: out_free:
if (clnt->cl_dentry)
dput(clnt->cl_dentry);
kfree(clnt); kfree(clnt);
return 0; return 0;
} }
......
...@@ -669,7 +669,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client) ...@@ -669,7 +669,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
out: out:
mutex_unlock(&dir->i_mutex); mutex_unlock(&dir->i_mutex);
rpc_release_path(&nd); rpc_release_path(&nd);
return dentry; return dget(dentry);
err_depopulate: err_depopulate:
rpc_depopulate(dentry); rpc_depopulate(dentry);
__rpc_rmdir(dir, dentry); __rpc_rmdir(dir, dentry);
...@@ -733,7 +733,7 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags) ...@@ -733,7 +733,7 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags)
out: out:
mutex_unlock(&dir->i_mutex); mutex_unlock(&dir->i_mutex);
rpc_release_path(&nd); rpc_release_path(&nd);
return dentry; return dget(dentry);
err_dput: err_dput:
dput(dentry); dput(dentry);
dentry = ERR_PTR(-ENOMEM); dentry = ERR_PTR(-ENOMEM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册