aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/auth.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 8d6f1a176b15..55163af3dcaf 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -64,14 +64,26 @@ rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt)
64 struct rpc_authops *ops; 64 struct rpc_authops *ops;
65 u32 flavor = pseudoflavor_to_flavor(pseudoflavor); 65 u32 flavor = pseudoflavor_to_flavor(pseudoflavor);
66 66
67 if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor])) 67 auth = ERR_PTR(-EINVAL);
68 return ERR_PTR(-EINVAL); 68 if (flavor >= RPC_AUTH_MAXFLAVOR)
69 goto out;
70
71 /* FIXME - auth_flavors[] really needs an rw lock,
72 * and module refcounting. */
73#ifdef CONFIG_KMOD
74 if ((ops = auth_flavors[flavor]) == NULL)
75 request_module("rpc-auth-%u", flavor);
76#endif
77 if ((ops = auth_flavors[flavor]) == NULL)
78 goto out;
69 auth = ops->create(clnt, pseudoflavor); 79 auth = ops->create(clnt, pseudoflavor);
70 if (IS_ERR(auth)) 80 if (IS_ERR(auth))
71 return auth; 81 return auth;
72 if (clnt->cl_auth) 82 if (clnt->cl_auth)
73 rpcauth_destroy(clnt->cl_auth); 83 rpcauth_destroy(clnt->cl_auth);
74 clnt->cl_auth = auth; 84 clnt->cl_auth = auth;
85
86out:
75 return auth; 87 return auth;
76} 88}
77 89