diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-04 15:55:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-12 09:52:10 -0700 |
commit | c80a1c58deeac0c21cbf8d952c1bd08f1afbe8ed (patch) | |
tree | 8010ff3262fb4bc9b3c196e25f45115b6fdc0fa2 | |
parent | 020dff84998201602ae4d00bd38acafc62f5c693 (diff) |
NFSv4: Fix a memory leak in nfs4_discover_server_trunking
commit b193d59a4863ea670872d76dc99231ddeb598625 upstream.
When we assign a new rpc_client to clp->cl_rpcclient, we need to destroy
the old one.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/nfs/nfs4state.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index e61f68d5ef21..994fbe2c714c 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1877,7 +1877,13 @@ again: status = PTR_ERR(clnt); break; } - clp->cl_rpcclient = clnt; + /* Note: this is safe because we haven't yet marked the + * client as ready, so we are the only user of + * clp->cl_rpcclient + */ + clnt = xchg(&clp->cl_rpcclient, clnt); + rpc_shutdown_client(clnt); + clnt = clp->cl_rpcclient; goto again; case -NFS4ERR_MINOR_VERS_MISMATCH: |