Commit 6b55970b authored by Kinglong Mee's avatar Kinglong Mee Committed by Trond Myklebust

nfs: Fix a memory leak when meeting an unsupported state protect

Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent db2efec0
...@@ -6972,7 +6972,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred, ...@@ -6972,7 +6972,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
/* unsupported! */ /* unsupported! */
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
status = -EINVAL; status = -EINVAL;
goto out_server_scope; goto out_impl_id;
} }
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
...@@ -7000,6 +7000,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred, ...@@ -7000,6 +7000,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
/* use the most recent implementation id */ /* use the most recent implementation id */
kfree(clp->cl_implid); kfree(clp->cl_implid);
clp->cl_implid = res.impl_id; clp->cl_implid = res.impl_id;
res.impl_id = NULL;
if (clp->cl_serverscope != NULL && if (clp->cl_serverscope != NULL &&
!nfs41_same_server_scope(clp->cl_serverscope, !nfs41_same_server_scope(clp->cl_serverscope,
...@@ -7013,15 +7014,16 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred, ...@@ -7013,15 +7014,16 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
if (clp->cl_serverscope == NULL) { if (clp->cl_serverscope == NULL) {
clp->cl_serverscope = res.server_scope; clp->cl_serverscope = res.server_scope;
goto out; res.server_scope = NULL;
} }
} else }
kfree(res.impl_id);
out_server_owner: out_impl_id:
kfree(res.server_owner); kfree(res.impl_id);
out_server_scope: out_server_scope:
kfree(res.server_scope); kfree(res.server_scope);
out_server_owner:
kfree(res.server_owner);
out: out:
if (clp->cl_implid != NULL) if (clp->cl_implid != NULL)
dprintk("NFS reply exchange_id: Server Implementation ID: " dprintk("NFS reply exchange_id: Server Implementation ID: "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment