diff options
-rw-r--r-- | fs/nfsd/nfs4state.c | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/gss_api.h | 2 | ||||
-rw-r--r-- | include/linux/sunrpc/svcauth.h | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_mech_switch.c | 5 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 4 |
5 files changed, 14 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 72f0c4e9a942..109b43402e82 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1188,6 +1188,9 @@ static int copy_cred(struct svc_cred *target, struct svc_cred *source) | |||
1188 | target->cr_gid = source->cr_gid; | 1188 | target->cr_gid = source->cr_gid; |
1189 | target->cr_group_info = source->cr_group_info; | 1189 | target->cr_group_info = source->cr_group_info; |
1190 | get_group_info(target->cr_group_info); | 1190 | get_group_info(target->cr_group_info); |
1191 | target->cr_gss_mech = source->cr_gss_mech; | ||
1192 | if (source->cr_gss_mech) | ||
1193 | gss_mech_get(source->cr_gss_mech); | ||
1191 | return 0; | 1194 | return 0; |
1192 | } | 1195 | } |
1193 | 1196 | ||
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index 161463e59624..1f911ccb2a75 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h | |||
@@ -151,6 +151,8 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32); | |||
151 | /* Fill in an array with a list of supported pseudoflavors */ | 151 | /* Fill in an array with a list of supported pseudoflavors */ |
152 | int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); | 152 | int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); |
153 | 153 | ||
154 | struct gss_api_mech * gss_mech_get(struct gss_api_mech *); | ||
155 | |||
154 | /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a | 156 | /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a |
155 | * corresponding call to gss_mech_put. */ | 157 | * corresponding call to gss_mech_put. */ |
156 | void gss_mech_put(struct gss_api_mech *); | 158 | void gss_mech_put(struct gss_api_mech *); |
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h index 95c956613a9c..8d71d6577459 100644 --- a/include/linux/sunrpc/svcauth.h +++ b/include/linux/sunrpc/svcauth.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/sunrpc/msg_prot.h> | 15 | #include <linux/sunrpc/msg_prot.h> |
16 | #include <linux/sunrpc/cache.h> | 16 | #include <linux/sunrpc/cache.h> |
17 | #include <linux/sunrpc/gss_api.h> | ||
17 | #include <linux/hash.h> | 18 | #include <linux/hash.h> |
18 | #include <linux/cred.h> | 19 | #include <linux/cred.h> |
19 | 20 | ||
@@ -23,6 +24,7 @@ struct svc_cred { | |||
23 | struct group_info *cr_group_info; | 24 | struct group_info *cr_group_info; |
24 | u32 cr_flavor; /* pseudoflavor */ | 25 | u32 cr_flavor; /* pseudoflavor */ |
25 | char *cr_principal; /* for gss */ | 26 | char *cr_principal; /* for gss */ |
27 | struct gss_api_mech *cr_gss_mech; | ||
26 | }; | 28 | }; |
27 | 29 | ||
28 | static inline void init_svc_cred(struct svc_cred *cred) | 30 | static inline void init_svc_cred(struct svc_cred *cred) |
@@ -37,6 +39,8 @@ static inline void free_svc_cred(struct svc_cred *cred) | |||
37 | if (cred->cr_group_info) | 39 | if (cred->cr_group_info) |
38 | put_group_info(cred->cr_group_info); | 40 | put_group_info(cred->cr_group_info); |
39 | kfree(cred->cr_principal); | 41 | kfree(cred->cr_principal); |
42 | gss_mech_put(cred->cr_gss_mech); | ||
43 | init_svc_cred(cred); | ||
40 | } | 44 | } |
41 | 45 | ||
42 | struct svc_rqst; /* forward decl */ | 46 | struct svc_rqst; /* forward decl */ |
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index defa9d33925c..27ce26240932 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | |||
@@ -139,11 +139,12 @@ void gss_mech_unregister(struct gss_api_mech *gm) | |||
139 | } | 139 | } |
140 | EXPORT_SYMBOL_GPL(gss_mech_unregister); | 140 | EXPORT_SYMBOL_GPL(gss_mech_unregister); |
141 | 141 | ||
142 | static struct gss_api_mech *gss_mech_get(struct gss_api_mech *gm) | 142 | struct gss_api_mech *gss_mech_get(struct gss_api_mech *gm) |
143 | { | 143 | { |
144 | __module_get(gm->gm_owner); | 144 | __module_get(gm->gm_owner); |
145 | return gm; | 145 | return gm; |
146 | } | 146 | } |
147 | EXPORT_SYMBOL(gss_mech_get); | ||
147 | 148 | ||
148 | static struct gss_api_mech * | 149 | static struct gss_api_mech * |
149 | _gss_mech_get_by_name(const char *name) | 150 | _gss_mech_get_by_name(const char *name) |
@@ -360,6 +361,7 @@ gss_pseudoflavor_to_service(struct gss_api_mech *gm, u32 pseudoflavor) | |||
360 | } | 361 | } |
361 | return 0; | 362 | return 0; |
362 | } | 363 | } |
364 | EXPORT_SYMBOL(gss_pseudoflavor_to_service); | ||
363 | 365 | ||
364 | char * | 366 | char * |
365 | gss_service_to_auth_domain_name(struct gss_api_mech *gm, u32 service) | 367 | gss_service_to_auth_domain_name(struct gss_api_mech *gm, u32 service) |
@@ -379,6 +381,7 @@ gss_mech_put(struct gss_api_mech * gm) | |||
379 | if (gm) | 381 | if (gm) |
380 | module_put(gm->gm_owner); | 382 | module_put(gm->gm_owner); |
381 | } | 383 | } |
384 | EXPORT_SYMBOL(gss_mech_put); | ||
382 | 385 | ||
383 | /* The mech could probably be determined from the token instead, but it's just | 386 | /* The mech could probably be determined from the token instead, but it's just |
384 | * as easy for now to pass it in. */ | 387 | * as easy for now to pass it in. */ |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 8d7860ee2398..0265bb3a8689 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -391,7 +391,6 @@ update_rsc(struct cache_head *cnew, struct cache_head *ctmp) | |||
391 | memset(&new->seqdata, 0, sizeof(new->seqdata)); | 391 | memset(&new->seqdata, 0, sizeof(new->seqdata)); |
392 | spin_lock_init(&new->seqdata.sd_lock); | 392 | spin_lock_init(&new->seqdata.sd_lock); |
393 | new->cred = tmp->cred; | 393 | new->cred = tmp->cred; |
394 | new->cred.cr_principal = tmp->cred.cr_principal; | ||
395 | init_svc_cred(&tmp->cred); | 394 | init_svc_cred(&tmp->cred); |
396 | } | 395 | } |
397 | 396 | ||
@@ -485,7 +484,7 @@ static int rsc_parse(struct cache_detail *cd, | |||
485 | len = qword_get(&mesg, buf, mlen); | 484 | len = qword_get(&mesg, buf, mlen); |
486 | if (len < 0) | 485 | if (len < 0) |
487 | goto out; | 486 | goto out; |
488 | gm = gss_mech_get_by_name(buf); | 487 | gm = rsci.cred.cr_gss_mech = gss_mech_get_by_name(buf); |
489 | status = -EOPNOTSUPP; | 488 | status = -EOPNOTSUPP; |
490 | if (!gm) | 489 | if (!gm) |
491 | goto out; | 490 | goto out; |
@@ -515,7 +514,6 @@ static int rsc_parse(struct cache_detail *cd, | |||
515 | rscp = rsc_update(cd, &rsci, rscp); | 514 | rscp = rsc_update(cd, &rsci, rscp); |
516 | status = 0; | 515 | status = 0; |
517 | out: | 516 | out: |
518 | gss_mech_put(gm); | ||
519 | rsc_free(&rsci); | 517 | rsc_free(&rsci); |
520 | if (rscp) | 518 | if (rscp) |
521 | cache_put(&rscp->h, cd); | 519 | cache_put(&rscp->h, cd); |