SUNRPC: Fix a credential refcount leak
authorTrond Myklebust <trondmy@gmail.com>
Thu, 20 Jun 2019 14:47:40 +0000 (10:47 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 21 Jun 2019 18:45:09 +0000 (14:45 -0400)
All callers of __rpc_clone_client() pass in a value for args->cred,
meaning that the credential gets assigned and referenced in
the call to rpc_new_client().

Reported-by: Ido Schimmel <idosch@idosch.org>
Fixes: 79caa5fad47c ("SUNRPC: Cache cred of process creating the rpc_client")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/clnt.c

index 2b353472364fc61d376099148b588605c955afd9..b03bfa055c0827972cfe497a2dbf98df42f28445 100644 (file)
@@ -634,7 +634,6 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
        new->cl_discrtry = clnt->cl_discrtry;
        new->cl_chatty = clnt->cl_chatty;
        new->cl_principal = clnt->cl_principal;
-       new->cl_cred = get_cred(clnt->cl_cred);
        return new;
 
 out_err: