diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth.c | 6 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 13 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 6 |
3 files changed, 16 insertions, 9 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 9bcec9b927b9..505e2d4b3d62 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -66,10 +66,10 @@ rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt) | |||
66 | u32 flavor = pseudoflavor_to_flavor(pseudoflavor); | 66 | u32 flavor = pseudoflavor_to_flavor(pseudoflavor); |
67 | 67 | ||
68 | if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor])) | 68 | if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor])) |
69 | return NULL; | 69 | return ERR_PTR(-EINVAL); |
70 | auth = ops->create(clnt, pseudoflavor); | 70 | auth = ops->create(clnt, pseudoflavor); |
71 | if (!auth) | 71 | if (IS_ERR(auth)) |
72 | return NULL; | 72 | return auth; |
73 | if (clnt->cl_auth) | 73 | if (clnt->cl_auth) |
74 | rpcauth_destroy(clnt->cl_auth); | 74 | rpcauth_destroy(clnt->cl_auth); |
75 | clnt->cl_auth = auth; | 75 | clnt->cl_auth = auth; |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 7d88db83ab12..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!", |
@@ -686,15 +688,18 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
686 | auth->au_flavor = flavor; | 688 | auth->au_flavor = flavor; |
687 | atomic_set(&auth->au_count, 1); | 689 | atomic_set(&auth->au_count, 1); |
688 | 690 | ||
689 | if (rpcauth_init_credcache(auth, GSS_CRED_EXPIRE) < 0) | 691 | err = rpcauth_init_credcache(auth, GSS_CRED_EXPIRE); |
692 | if (err) | ||
690 | goto err_put_mech; | 693 | goto err_put_mech; |
691 | 694 | ||
692 | snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s", | 695 | snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s", |
693 | clnt->cl_pathname, | 696 | clnt->cl_pathname, |
694 | gss_auth->mech->gm_name); | 697 | gss_auth->mech->gm_name); |
695 | 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); |
696 | if (IS_ERR(gss_auth->dentry)) | 699 | if (IS_ERR(gss_auth->dentry)) { |
700 | err = PTR_ERR(gss_auth->dentry); | ||
697 | goto err_put_mech; | 701 | goto err_put_mech; |
702 | } | ||
698 | 703 | ||
699 | return auth; | 704 | return auth; |
700 | err_put_mech: | 705 | err_put_mech: |
@@ -703,7 +708,7 @@ err_free: | |||
703 | kfree(gss_auth); | 708 | kfree(gss_auth); |
704 | out_dec: | 709 | out_dec: |
705 | module_put(THIS_MODULE); | 710 | module_put(THIS_MODULE); |
706 | return NULL; | 711 | return ERR_PTR(err); |
707 | } | 712 | } |
708 | 713 | ||
709 | static void | 714 | static void |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index b36797ad8083..9da1deb482e2 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -103,6 +103,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname, | |||
103 | { | 103 | { |
104 | struct rpc_version *version; | 104 | struct rpc_version *version; |
105 | struct rpc_clnt *clnt = NULL; | 105 | struct rpc_clnt *clnt = NULL; |
106 | struct rpc_auth *auth; | ||
106 | int err; | 107 | int err; |
107 | int len; | 108 | int len; |
108 | 109 | ||
@@ -157,10 +158,11 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname, | |||
157 | if (err < 0) | 158 | if (err < 0) |
158 | goto out_no_path; | 159 | goto out_no_path; |
159 | 160 | ||
160 | err = -ENOMEM; | 161 | auth = rpcauth_create(flavor, clnt); |
161 | if (!rpcauth_create(flavor, clnt)) { | 162 | if (IS_ERR(auth)) { |
162 | printk(KERN_INFO "RPC: Couldn't create auth handle (flavor %u)\n", | 163 | printk(KERN_INFO "RPC: Couldn't create auth handle (flavor %u)\n", |
163 | flavor); | 164 | flavor); |
165 | err = PTR_ERR(auth); | ||
164 | goto out_no_auth; | 166 | goto out_no_auth; |
165 | } | 167 | } |
166 | 168 | ||