aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-05-14 16:53:40 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-07-01 17:23:06 -0400
commit442340639194762df7e61e8aabae44a18896eca1 (patch)
tree95adc5287a1c3c43b50e0d12183d8bd5a596e43b
parentMerge branch 'for-3.10' into 'for-3.11' (diff)
downloadwireguard-linux-442340639194762df7e61e8aabae44a18896eca1.tar.xz
wireguard-linux-442340639194762df7e61e8aabae44a18896eca1.zip
svcrpc: introduce init_svc_cred
Common helper to zero out fields of the svc_cred. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--include/linux/sunrpc/svcauth.h7
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c6
2 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index ff374ab30839..95c956613a9c 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -25,6 +25,13 @@ struct svc_cred {
char *cr_principal; /* for gss */
};
+static inline void init_svc_cred(struct svc_cred *cred)
+{
+ cred->cr_group_info = NULL;
+ cred->cr_principal = NULL;
+ cred->cr_gss_mech = NULL;
+}
+
static inline void free_svc_cred(struct svc_cred *cred)
{
if (cred->cr_group_info)
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 29b4ba93ab3c..8d7860ee2398 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -377,8 +377,7 @@ rsc_init(struct cache_head *cnew, struct cache_head *ctmp)
new->handle.data = tmp->handle.data;
tmp->handle.data = NULL;
new->mechctx = NULL;
- new->cred.cr_group_info = NULL;
- new->cred.cr_principal = NULL;
+ init_svc_cred(&new->cred);
}
static void
@@ -392,9 +391,8 @@ update_rsc(struct cache_head *cnew, struct cache_head *ctmp)
memset(&new->seqdata, 0, sizeof(new->seqdata));
spin_lock_init(&new->seqdata.sd_lock);
new->cred = tmp->cred;
- tmp->cred.cr_group_info = NULL;
new->cred.cr_principal = tmp->cred.cr_principal;
- tmp->cred.cr_principal = NULL;
+ init_svc_cred(&tmp->cred);
}
static struct cache_head *