diff options
Diffstat (limited to 'net/sunrpc/auth_gss/auth_gss.c')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index a33b627cbef4..2f7b867161d2 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -660,14 +660,16 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
660 | { | 660 | { |
661 | struct gss_auth *gss_auth; | 661 | struct gss_auth *gss_auth; |
662 | struct rpc_auth * auth; | 662 | struct rpc_auth * auth; |
663 | int err = -ENOMEM; /* XXX? */ | ||
663 | 664 | ||
664 | dprintk("RPC: creating GSS authenticator for client %p\n",clnt); | 665 | dprintk("RPC: creating GSS authenticator for client %p\n",clnt); |
665 | 666 | ||
666 | if (!try_module_get(THIS_MODULE)) | 667 | if (!try_module_get(THIS_MODULE)) |
667 | return NULL; | 668 | return ERR_PTR(err); |
668 | if (!(gss_auth = kmalloc(sizeof(*gss_auth), GFP_KERNEL))) | 669 | if (!(gss_auth = kmalloc(sizeof(*gss_auth), GFP_KERNEL))) |
669 | goto out_dec; | 670 | goto out_dec; |
670 | gss_auth->client = clnt; | 671 | gss_auth->client = clnt; |
672 | err = -EINVAL; | ||
671 | gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor); | 673 | gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor); |
672 | if (!gss_auth->mech) { | 674 | if (!gss_auth->mech) { |
673 | printk(KERN_WARNING "%s: Pseudoflavor %d not found!", | 675 | printk(KERN_WARNING "%s: Pseudoflavor %d not found!", |
@@ -675,9 +677,8 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
675 | goto err_free; | 677 | goto err_free; |
676 | } | 678 | } |
677 | gss_auth->service = gss_pseudoflavor_to_service(gss_auth->mech, flavor); | 679 | gss_auth->service = gss_pseudoflavor_to_service(gss_auth->mech, flavor); |
678 | /* FIXME: Will go away once privacy support is merged in */ | 680 | if (gss_auth->service == 0) |
679 | if (gss_auth->service == RPC_GSS_SVC_PRIVACY) | 681 | goto err_put_mech; |
680 | gss_auth->service = RPC_GSS_SVC_INTEGRITY; | ||
681 | INIT_LIST_HEAD(&gss_auth->upcalls); | 682 | INIT_LIST_HEAD(&gss_auth->upcalls); |
682 | spin_lock_init(&gss_auth->lock); | 683 | spin_lock_init(&gss_auth->lock); |
683 | auth = &gss_auth->rpc_auth; | 684 | auth = &gss_auth->rpc_auth; |
@@ -687,15 +688,18 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
687 | auth->au_flavor = flavor; | 688 | auth->au_flavor = flavor; |
688 | atomic_set(&auth->au_count, 1); | 689 | atomic_set(&auth->au_count, 1); |
689 | 690 | ||
690 | if (rpcauth_init_credcache(auth, GSS_CRED_EXPIRE) < 0) | 691 | err = rpcauth_init_credcache(auth, GSS_CRED_EXPIRE); |
692 | if (err) | ||
691 | goto err_put_mech; | 693 | goto err_put_mech; |
692 | 694 | ||
693 | snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s", | 695 | snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s", |
694 | clnt->cl_pathname, | 696 | clnt->cl_pathname, |
695 | gss_auth->mech->gm_name); | 697 | gss_auth->mech->gm_name); |
696 | gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); | 698 | gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); |
697 | if (IS_ERR(gss_auth->dentry)) | 699 | if (IS_ERR(gss_auth->dentry)) { |
700 | err = PTR_ERR(gss_auth->dentry); | ||
698 | goto err_put_mech; | 701 | goto err_put_mech; |
702 | } | ||
699 | 703 | ||
700 | return auth; | 704 | return auth; |
701 | err_put_mech: | 705 | err_put_mech: |
@@ -704,7 +708,7 @@ err_free: | |||
704 | kfree(gss_auth); | 708 | kfree(gss_auth); |
705 | out_dec: | 709 | out_dec: |
706 | module_put(THIS_MODULE); | 710 | module_put(THIS_MODULE); |
707 | return NULL; | 711 | return ERR_PTR(err); |
708 | } | 712 | } |
709 | 713 | ||
710 | static void | 714 | static void |