ubifs: xattr: Fix some potential memory leaks while iterating entries
authorZhihao Cheng <chengzhihao1@huawei.com>
Mon, 1 Jun 2020 09:10:36 +0000 (17:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:51:46 +0000 (11:51 +0100)
commitae623c57f2c9683f403ed7e069f5d2e3da604d4b
tree66c2e26ec782eb23980b578dd6fff602174aa6cd
parent1b50e507831ac11bc193b93de97129b26714e28a
ubifs: xattr: Fix some potential memory leaks while iterating entries

commit f2aae745b82c842221f4f233051f9ac641790959 upstream.

Fix some potential memory leaks in error handling branches while
iterating xattr entries. For example, function ubifs_tnc_remove_ino()
forgets to free pxent if it exists. Similar problems also exist in
ubifs_purge_xattrs(), ubifs_add_orphan() and ubifs_jnl_write_inode().

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: <stable@vger.kernel.org>
Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ubifs/journal.c
fs/ubifs/orphan.c
fs/ubifs/tnc.c
fs/ubifs/xattr.c