]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sunrpc/auth_unix.c
SUNRPC: Fix a memory leak in the auth credcache code
[linux-2.6-omap-h63xx.git] / net / sunrpc / auth_unix.c
index f7f990c9afe2ef805b2ea75e1d9b23dbb7f2d2fc..5622783011a4824eea6045fbce39a4a1e57e025f 100644 (file)
@@ -39,7 +39,8 @@ static struct rpc_credops     unix_credops;
 static struct rpc_auth *
 unx_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
 {
-       dprintk("RPC: creating UNIX authenticator for client %p\n", clnt);
+       dprintk("RPC:       creating UNIX authenticator for client %p\n",
+                       clnt);
        if (atomic_inc_return(&unix_auth.au_count) == 0)
                unix_cred_cache.nextgc = jiffies + (unix_cred_cache.expire >> 1);
        return &unix_auth;
@@ -48,8 +49,8 @@ unx_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
 static void
 unx_destroy(struct rpc_auth *auth)
 {
-       dprintk("RPC: destroying UNIX authenticator %p\n", auth);
-       rpcauth_free_credcache(auth);
+       dprintk("RPC:       destroying UNIX authenticator %p\n", auth);
+       rpcauth_clear_credcache(auth->au_credcache);
 }
 
 /*
@@ -67,8 +68,8 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
        struct unx_cred *cred;
        int             i;
 
-       dprintk("RPC:      allocating UNIX cred for uid %d gid %d\n",
-                               acred->uid, acred->gid);
+       dprintk("RPC:       allocating UNIX cred for uid %d gid %d\n",
+                       acred->uid, acred->gid);
 
        if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL)))
                return ERR_PTR(-ENOMEM);
@@ -91,6 +92,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
                if (i < NFS_NGROUPS)
                  cred->uc_gids[i] = NOGROUP;
        }
+       cred->uc_base.cr_auth = &unix_auth;
        cred->uc_base.cr_ops = &unix_credops;
 
        return (struct rpc_cred *) cred;