]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ubifs: dent: Fix some potential memory leaks while iterating entries
authorZhihao Cheng <chengzhihao1@huawei.com>
Mon, 1 Jun 2020 09:10:37 +0000 (17:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:07:02 +0000 (11:07 +0100)
commit 58f6e78a65f1fcbf732f60a7478ccc99873ff3ba upstream.

Fix some potential memory leaks in error handling branches while
iterating dent entries. For example, function dbg_check_dir()
forgets to free pdent if it exists.

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/debug.c

index 7cd8a7b95299c2b096c93d0d0fbfd7838f8dff2c..80cdd64aa7c3a192ca2f4c9402d68dd8bc83c965 100644 (file)
@@ -1129,6 +1129,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir)
                        err = PTR_ERR(dent);
                        if (err == -ENOENT)
                                break;
+                       kfree(pdent);
                        return err;
                }