From: Wenwen Wang Date: Wed, 21 Aug 2019 03:21:21 +0000 (-0500) Subject: NFSv4: Fix a memory leak bug X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~3746^2~30 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=1e672e3644940d83bd94e7cb46bac6bb3627de02;p=linux.git 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 Signed-off-by: Anna Schumaker --- 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 } 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) {