FAILED: patch "[PATCH] ext4: fix memory leak in ext4_mb_init_backend on error path." failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a8867f4e3809050571c98de7a2d465aff5e4daf5 Mon Sep 17 00:00:00 2001
From: Phillip Potter <[email protected]>
Date: Mon, 12 Apr 2021 08:38:37 +0100
Subject: [PATCH] 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 [email protected]
Signed-off-by Phillip Potter <[email protected]>
Signed-off-by Theodore Ts'o <[email protected]>
fs/ext4/mballoc.c +1 -1
@@ -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 ));