This is a note to let you know that I've just added the patch titled ext4: fix memory leak in ext4_mb_init_backend on error path. to the 5.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-fix-memory-leak-in-ext4_mb_init_backend-on-error-path.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a8867f4e3809050571c98de7a2d465aff5e4daf5 Mon Sep 17 00:00:00 2001 From: Phillip Potter <phil@xxxxxxxxxxxxxxxx> Date: Mon, 12 Apr 2021 08:38:37 +0100 Subject: ext4: fix memory leak in ext4_mb_init_backend on error path. From: Phillip Potter <phil@xxxxxxxxxxxxxxxx> commit a8867f4e3809050571c98de7a2d465aff5e4daf5 upstream. 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@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Phillip Potter <phil@xxxxxxxxxxxxxxxx> Cc: stable@xxxxxxxxxx Link: https://lore.kernel.org/r/20210412073837.1686-1-phil@xxxxxxxxxxxxxxxx Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2715,7 +2715,7 @@ static int ext4_mb_init_backend(struct s */ 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)); Patches currently in stable-queue which might be from phil@xxxxxxxxxxxxxxxx are queue-5.12/ext4-fix-memory-leak-in-ext4_mb_init_backend-on-error-path.patch