diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:09 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:09 -0500 |
commit | 12de3b35ea549c5819f287508d7afab0bf3ac44d (patch) | |
tree | c1b7f96236c4b19bcd911705017bf31bcbc2b605 /net | |
parent | 24c5d9d7ea5a64fb5f157d17aa2c67a3300f8a08 (diff) |
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: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 2 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 3 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index bb46efd92e57..900ef31f5a0e 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -721,6 +721,8 @@ gss_destroy(struct rpc_auth *auth) | |||
721 | 721 | ||
722 | gss_auth = container_of(auth, struct gss_auth, rpc_auth); | 722 | gss_auth = container_of(auth, struct gss_auth, rpc_auth); |
723 | rpc_unlink(gss_auth->path); | 723 | rpc_unlink(gss_auth->path); |
724 | dput(gss_auth->dentry); | ||
725 | gss_auth->dentry = NULL; | ||
724 | gss_mech_put(gss_auth->mech); | 726 | gss_mech_put(gss_auth->mech); |
725 | 727 | ||
726 | rpcauth_free_credcache(auth); | 728 | rpcauth_free_credcache(auth); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index d78479782045..a6d7c332dd49 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -240,6 +240,7 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
240 | new->cl_autobind = 0; | 240 | new->cl_autobind = 0; |
241 | new->cl_oneshot = 0; | 241 | new->cl_oneshot = 0; |
242 | new->cl_dead = 0; | 242 | new->cl_dead = 0; |
243 | dget(new->cl_dentry); | ||
243 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); | 244 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); |
244 | if (new->cl_auth) | 245 | if (new->cl_auth) |
245 | atomic_inc(&new->cl_auth->au_count); | 246 | atomic_inc(&new->cl_auth->au_count); |
@@ -314,6 +315,8 @@ rpc_destroy_client(struct rpc_clnt *clnt) | |||
314 | if (clnt->cl_server != clnt->cl_inline_name) | 315 | if (clnt->cl_server != clnt->cl_inline_name) |
315 | kfree(clnt->cl_server); | 316 | kfree(clnt->cl_server); |
316 | out_free: | 317 | out_free: |
318 | if (clnt->cl_dentry) | ||
319 | dput(clnt->cl_dentry); | ||
317 | kfree(clnt); | 320 | kfree(clnt); |
318 | return 0; | 321 | return 0; |
319 | } | 322 | } |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 567abbe25bc8..72b22172f0af 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -669,7 +669,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client) | |||
669 | out: | 669 | out: |
670 | mutex_unlock(&dir->i_mutex); | 670 | mutex_unlock(&dir->i_mutex); |
671 | rpc_release_path(&nd); | 671 | rpc_release_path(&nd); |
672 | return dentry; | 672 | return dget(dentry); |
673 | err_depopulate: | 673 | err_depopulate: |
674 | rpc_depopulate(dentry); | 674 | rpc_depopulate(dentry); |
675 | __rpc_rmdir(dir, dentry); | 675 | __rpc_rmdir(dir, dentry); |
@@ -733,7 +733,7 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags) | |||
733 | out: | 733 | out: |
734 | mutex_unlock(&dir->i_mutex); | 734 | mutex_unlock(&dir->i_mutex); |
735 | rpc_release_path(&nd); | 735 | rpc_release_path(&nd); |
736 | return dentry; | 736 | return dget(dentry); |
737 | err_dput: | 737 | err_dput: |
738 | dput(dentry); | 738 | dput(dentry); |
739 | dentry = ERR_PTR(-ENOMEM); | 739 | dentry = ERR_PTR(-ENOMEM); |