Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b193d59a authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: stable@vger.kernel.org [>=3.7]
parent a58e0be6
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -1886,7 +1886,13 @@ int nfs4_discover_server_trunking(struct nfs_client *clp,
			status = PTR_ERR(clnt);
			status = PTR_ERR(clnt);
			break;
			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;
		goto again;


	case -NFS4ERR_MINOR_VERS_MISMATCH:
	case -NFS4ERR_MINOR_VERS_MISMATCH: