aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-20 23:21:21 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-08-21 16:39:29 -0400
commit1e672e3644940d83bd94e7cb46bac6bb3627de02 (patch)
treec0c89d96442a7b4bcca9cfad564447131ba5d3ef /fs
parent435eba4ae0692e2f3d62988f8648efd65c935b6a (diff)
NFSv4: Fix a memory leak bug
In nfs4_try_migration(), if nfs4_begin_drain_session() fails, the previously allocated 'page' and 'locations' are not deallocated, leading to memory leaks. To fix this issue, go to the 'out' label to free 'page' and 'locations' before returning the error. Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4state.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index cad4e064b328..e916aba7a799 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -2095,8 +2095,10 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
2095 } 2095 }
2096 2096
2097 status = nfs4_begin_drain_session(clp); 2097 status = nfs4_begin_drain_session(clp);
2098 if (status != 0) 2098 if (status != 0) {
2099 return status; 2099 result = status;
2100 goto out;
2101 }
2100 2102
2101 status = nfs4_replace_transport(server, locations); 2103 status = nfs4_replace_transport(server, locations);
2102 if (status != 0) { 2104 if (status != 0) {