add patch avoid-memory-leak-of-s_journal_flag_rwsem-on-error-path
[ext4-patch-queue.git] / fix-possible-inode-leak-in-retry-loop-of-ext4_resize_fs
blob5fee77d07c6d3f8c3c6e35332b64bf156695e207
1 ext4: fix possible inode leak in the retry loop of ext4_resize_fs()
3 From:   Vasily Averin <vvs@virtuozzo.com>
5 Fixes: 1c6bd7173d66 ("ext4: convert file system to meta_bg if needed ...")
6 Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
7 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 Cc: stable@kernel.org # 3.7
9 ---
10  fs/ext4/resize.c | 4 ++++
11  1 file changed, 4 insertions(+)
13 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
14 index 5fee65afd58b..85158e9de7c2 100644
15 --- a/fs/ext4/resize.c
16 +++ b/fs/ext4/resize.c
17 @@ -2058,6 +2058,10 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)
18                 n_blocks_count_retry = 0;
19                 free_flex_gd(flex_gd);
20                 flex_gd = NULL;
21 +               if (resize_inode) {
22 +                       iput(resize_inode);
23 +                       resize_inode = NULL;
24 +               }
25                 goto retry;
26         }
28 -- 
29 2.17.1