diff options
author | Phillip Potter <phil@philpotter.co.uk> | 2021-04-12 08:38:37 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-05-20 23:29:32 -0400 |
commit | a8867f4e3809050571c98de7a2d465aff5e4daf5 (patch) | |
tree | b6c370b11951a46ab261864093a5458f487aa402 /fs | |
parent | 6c0912739699d8e4b6a87086401bf3ad3c59502d (diff) | |
download | linux-a8867f4e3809050571c98de7a2d465aff5e4daf5.tar.gz linux-a8867f4e3809050571c98de7a2d465aff5e4daf5.tar.bz2 linux-a8867f4e3809050571c98de7a2d465aff5e4daf5.zip |
ext4: fix memory leak in ext4_mb_init_backend on error path.
Fix a memory leak discovered by syzbot when a file system is corrupted
with an illegally large s_log_groups_per_flex.
Reported-by: syzbot+aa12d6106ea4ca1b6aae@syzkaller.appspotmail.com
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20210412073837.1686-1-phil@philpotter.co.uk
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/mballoc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 3239e6669e84..c2c22c2baac0 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3217,7 +3217,7 @@ static int ext4_mb_init_backend(struct super_block *sb) */ if (sbi->s_es->s_log_groups_per_flex >= 32) { ext4_msg(sb, KERN_ERR, "too many log groups per flexible block group"); - goto err_freesgi; + goto err_freebuddy; } sbi->s_mb_prefetch = min_t(uint, 1 << sbi->s_es->s_log_groups_per_flex, BLK_MAX_SEGMENT_SIZE >> (sb->s_blocksize_bits - 9)); |