]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFS: Fix memory leaks
authorWenwen Wang <wenwen@cs.uga.edu>
Mon, 3 Feb 2020 03:47:53 +0000 (03:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:38:50 +0000 (08:38 +0100)
commit588f2bf818eda8ee9e4f703d8d1095aa6b16437e
tree5f1daf9c57def7ab6602ff3e5d737a2b3dc18f84
parent24add5b4849b43c33d6500d25fe686d1d1e4549c
NFS: Fix memory leaks

[ Upstream commit 123c23c6a7b7ecd2a3d6060bea1d94019f71fd66 ]

In _nfs42_proc_copy(), 'res->commit_res.verf' is allocated through
kzalloc() if 'args->sync' is true. In the following code, if
'res->synchronous' is false, handle_async_copy() will be invoked. If an
error occurs during the invocation, the following code will not be executed
and the error will be returned . However, the allocated
'res->commit_res.verf' is not deallocated, leading to a memory leak. This
is also true if the invocation of process_copy_commit() returns an error.

To fix the above leaks, redirect the execution to the 'out' label if an
error is encountered.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs42proc.c