Skip to content

Commit

Permalink
NFSv4: Fix a memory leak bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wenwen Wang authored and Anna Schumaker committed Aug 21, 2019
1 parent 435eba4 commit 1e672e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/nfs/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2095,8 +2095,10 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
}

status = nfs4_begin_drain_session(clp);
if (status != 0)
return status;
if (status != 0) {
result = status;
goto out;
}

status = nfs4_replace_transport(server, locations);
if (status != 0) {
Expand Down

0 comments on commit 1e672e3

Please sign in to comment.