SUNRPC: Fix a credential refcount leak
diff mbox series

Message ID 20190620144740.4169-1-trond.myklebust@hammerspace.com
State New
Headers show
Series
  • SUNRPC: Fix a credential refcount leak
Related show

Commit Message

Trond Myklebust June 20, 2019, 2:47 p.m. UTC
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>
---
 net/sunrpc/clnt.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Ido Schimmel June 20, 2019, 3:35 p.m. UTC | #1
On Thu, Jun 20, 2019 at 10:47:40AM -0400, Trond Myklebust wrote:
> 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>

Thanks a lot!

Patch
diff mbox series

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 627a87a71f8b..010e59cf2ae0 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -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: