diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-04 15:55:00 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-05 16:59:15 -0400 |
commit | b193d59a4863ea670872d76dc99231ddeb598625 (patch) | |
tree | f6bed05e08eb1a3c8b90b994f51c863d19fce59e /fs/nfs | |
parent | a58e0be6f6b3eb2079b0b8fedc9df6fa86869f1e (diff) |
NFSv4: Fix a memory leak in nfs4_discover_server_trunking
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>
Cc: stable@vger.kernel.org [>=3.7]
Diffstat (limited to 'fs/nfs')
-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 6ace365c6334..d41a3518509f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1886,7 +1886,13 @@ again: | |||
1886 | status = PTR_ERR(clnt); | 1886 | status = PTR_ERR(clnt); |
1887 | break; | 1887 | break; |
1888 | } | 1888 | } |
1889 | clp->cl_rpcclient = clnt; | 1889 | /* Note: this is safe because we haven't yet marked the |
1890 | * client as ready, so we are the only user of | ||
1891 | * clp->cl_rpcclient | ||
1892 | */ | ||
1893 | clnt = xchg(&clp->cl_rpcclient, clnt); | ||
1894 | rpc_shutdown_client(clnt); | ||
1895 | clnt = clp->cl_rpcclient; | ||
1890 | goto again; | 1896 | goto again; |
1891 | 1897 | ||
1892 | case -NFS4ERR_MINOR_VERS_MISMATCH: | 1898 | case -NFS4ERR_MINOR_VERS_MISMATCH: |