--- 1 file changed, 20 insertions(+), 15 deletions(-) --- diff -puN net/sunrpc/auth_unix.c~rpc-common-auth-unix net/sunrpc/auth_unix.c --- linux-2.6.18-rc5/net/sunrpc/auth_unix.c~rpc-common-auth-unix 2006-10-20 15:57:05.000000000 -0400 +++ linux-2.6.18-rc5-andros/net/sunrpc/auth_unix.c 2006-10-20 15:58:01.000000000 -0400 @@ -32,23 +32,38 @@ struct unx_cred { # define RPCDBG_FACILITY RPCDBG_AUTH #endif -static struct rpc_auth unix_auth; static struct rpc_credops unix_credops; static struct rpc_auth * unx_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) { + struct rpc_auth *auth; + int err = -ENOMEM; + dprintk("RPC: creating UNIX authenticator for client %p\n", clnt); - if (atomic_inc_return(&unix_auth.au_count) == 0) - unix_auth.au_nextgc = jiffies + (unix_auth.au_expire >> 1); - INIT_LIST_HEAD(&unix_auth.au_list); - return &unix_auth; + + if (!(auth = kmalloc(sizeof(*auth), GFP_KERNEL))) + goto out_err; + + auth->au_cslack = UNX_WRITESLACK; + auth->au_rslack = 2; + auth->au_ops = &authunix_ops; + auth->au_flavor = RPC_AUTH_UNIX; + atomic_set(&auth->au_count, 1); + auth->au_expire = UNX_CRED_EXPIRE; + INIT_LIST_HEAD(&auth->au_list); + return auth; + +out_err: + dprintk("RPC: ERROR creating UNIX authenticator for client %p\n", clnt); + return ERR_PTR(err); } static void unx_destroy(struct rpc_auth *auth) { dprintk("RPC: destroying UNIX authenticator %p\n", auth); + kfree(auth); } /* @@ -216,16 +231,6 @@ struct rpc_authops authunix_ops = { }; static -struct rpc_auth unix_auth = { - .au_cslack = UNX_WRITESLACK, - .au_rslack = 2, /* assume AUTH_NULL verf */ - .au_ops = &authunix_ops, - .au_flavor = RPC_AUTH_UNIX, - .au_count = ATOMIC_INIT(0), - .au_expire = UNX_CRED_EXPIRE, -}; - -static struct rpc_credops unix_credops = { .cr_name = "AUTH_UNIX", .crdestroy = unx_destroy_cred, _