aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/auth.h3
-rw-r--r--net/sunrpc/auth.c18
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c3
-rw-r--r--net/sunrpc/auth_unix.c2
-rw-r--r--net/sunrpc/sunrpc_syms.c2
5 files changed, 22 insertions, 6 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 8ef27afeea73..3972b8414c88 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -143,7 +143,8 @@ int rpcauth_refreshcred(struct rpc_task *);
143void rpcauth_invalcred(struct rpc_task *); 143void rpcauth_invalcred(struct rpc_task *);
144int rpcauth_uptodatecred(struct rpc_task *); 144int rpcauth_uptodatecred(struct rpc_task *);
145int rpcauth_init_credcache(struct rpc_auth *, unsigned long); 145int rpcauth_init_credcache(struct rpc_auth *, unsigned long);
146void rpcauth_free_credcache(struct rpc_auth *); 146void rpcauth_destroy_credcache(struct rpc_auth *);
147void rpcauth_clear_credcache(struct rpc_cred_cache *);
147 148
148static inline 149static inline
149struct rpc_cred * get_rpccred(struct rpc_cred *cred) 150struct rpc_cred * get_rpccred(struct rpc_cred *cred)
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 9527f2bb1744..f6b6c81cbc3e 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -137,9 +137,8 @@ void rpcauth_destroy_credlist(struct hlist_head *head)
137 * that are not referenced. 137 * that are not referenced.
138 */ 138 */
139void 139void
140rpcauth_free_credcache(struct rpc_auth *auth) 140rpcauth_clear_credcache(struct rpc_cred_cache *cache)
141{ 141{
142 struct rpc_cred_cache *cache = auth->au_credcache;
143 HLIST_HEAD(free); 142 HLIST_HEAD(free);
144 struct hlist_node *pos, *next; 143 struct hlist_node *pos, *next;
145 struct rpc_cred *cred; 144 struct rpc_cred *cred;
@@ -157,6 +156,21 @@ rpcauth_free_credcache(struct rpc_auth *auth)
157 rpcauth_destroy_credlist(&free); 156 rpcauth_destroy_credlist(&free);
158} 157}
159 158
159/*
160 * Destroy the RPC credential cache
161 */
162void
163rpcauth_destroy_credcache(struct rpc_auth *auth)
164{
165 struct rpc_cred_cache *cache = auth->au_credcache;
166
167 if (cache) {
168 auth->au_credcache = NULL;
169 rpcauth_clear_credcache(cache);
170 kfree(cache);
171 }
172}
173
160static void 174static void
161rpcauth_prune_expired(struct rpc_auth *auth, struct rpc_cred *cred, struct hlist_head *free) 175rpcauth_prune_expired(struct rpc_auth *auth, struct rpc_cred *cred, struct hlist_head *free)
162{ 176{
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 50809086fa1b..8b4c02f8befb 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -665,12 +665,13 @@ gss_destroy(struct rpc_auth *auth)
665 dprintk("RPC: destroying GSS authenticator %p flavor %d\n", 665 dprintk("RPC: destroying GSS authenticator %p flavor %d\n",
666 auth, auth->au_flavor); 666 auth, auth->au_flavor);
667 667
668 rpcauth_destroy_credcache(auth);
669
668 gss_auth = container_of(auth, struct gss_auth, rpc_auth); 670 gss_auth = container_of(auth, struct gss_auth, rpc_auth);
669 rpc_unlink(gss_auth->dentry); 671 rpc_unlink(gss_auth->dentry);
670 gss_auth->dentry = NULL; 672 gss_auth->dentry = NULL;
671 gss_mech_put(gss_auth->mech); 673 gss_mech_put(gss_auth->mech);
672 674
673 rpcauth_free_credcache(auth);
674 kfree(gss_auth); 675 kfree(gss_auth);
675 module_put(THIS_MODULE); 676 module_put(THIS_MODULE);
676} 677}
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 82300b83045e..5622783011a4 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -50,7 +50,7 @@ static void
50unx_destroy(struct rpc_auth *auth) 50unx_destroy(struct rpc_auth *auth)
51{ 51{
52 dprintk("RPC: destroying UNIX authenticator %p\n", auth); 52 dprintk("RPC: destroying UNIX authenticator %p\n", auth);
53 rpcauth_free_credcache(auth); 53 rpcauth_clear_credcache(auth->au_credcache);
54} 54}
55 55
56/* 56/*
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index b99b11b11461..3e19e7af6799 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -57,7 +57,7 @@ EXPORT_SYMBOL(rpcauth_unregister);
57EXPORT_SYMBOL(rpcauth_create); 57EXPORT_SYMBOL(rpcauth_create);
58EXPORT_SYMBOL(rpcauth_lookupcred); 58EXPORT_SYMBOL(rpcauth_lookupcred);
59EXPORT_SYMBOL(rpcauth_lookup_credcache); 59EXPORT_SYMBOL(rpcauth_lookup_credcache);
60EXPORT_SYMBOL(rpcauth_free_credcache); 60EXPORT_SYMBOL(rpcauth_destroy_credcache);
61EXPORT_SYMBOL(rpcauth_init_credcache); 61EXPORT_SYMBOL(rpcauth_init_credcache);
62EXPORT_SYMBOL(put_rpccred); 62EXPORT_SYMBOL(put_rpccred);
63 63