[PATCH 3.16 148/305] ext4: fix possible inode leak in the retry loop of ext4_resize_fs()

From: Ben Hutchings
Date: Sun Feb 03 2019 - 09:00:22 EST


3.16.63-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Vasily Averin <vvs@xxxxxxxxxxxxx>

commit db6aee62406d9fbb53315fcddd81f1dc271d49fa upstream.

Fixes: 1c6bd7173d66 ("ext4: convert file system to meta_bg if needed ...")
Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx>
Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
fs/ext4/resize.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -2029,6 +2029,10 @@ retry:
n_blocks_count_retry = 0;
free_flex_gd(flex_gd);
flex_gd = NULL;
+ if (resize_inode) {
+ iput(resize_inode);
+ resize_inode = NULL;
+ }
goto retry;
}