]> git.baikalelectronics.ru Git - kernel.git/commit
NFS: Fix memory leaks and corruption in readdir
authorTrond Myklebust <trondmy@gmail.com>
Sun, 2 Feb 2020 22:53:53 +0000 (17:53 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 3 Feb 2020 21:35:17 +0000 (16:35 -0500)
commitc18bd4177ea8e8caf4bd7933a5adc7b65da9d10f
tree8c829779d65e9f3cda6bbbc85671e176df20f06f
parent22ae571505fc5ed5e24a96db1e39956f1ffbb397
NFS: Fix memory leaks and corruption in readdir

nfs_readdir_xdr_to_array() must not exit without having initialised
the array, so that the page cache deletion routines can safely
call nfs_readdir_clear_array().
Furthermore, we should ensure that if we exit nfs_readdir_filler()
with an error, we free up any page contents to prevent a leak
if we try to fill the page again.

Fixes: e2bf13823337 ("NFS: Fix a memory leak in nfs_readdir")
Cc: stable@vger.kernel.org # v2.6.37+
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/dir.c