This is a note to let you know that I've just added the patch titled ext4: fixup possible uninitialized variable access in ext4_mb_choose_next_group_cr1() to the 5.19-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-fixup-possible-uninitialized-variable-access-in-ext4_mb_choose_next_group_cr1.patch and it can be found in the queue-5.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a078dff870136090b5779ca2831870a6c5539d36 Mon Sep 17 00:00:00 2001 From: Jan Kara <jack@xxxxxxx> Date: Thu, 22 Sep 2022 11:09:29 +0200 Subject: ext4: fixup possible uninitialized variable access in ext4_mb_choose_next_group_cr1() From: Jan Kara <jack@xxxxxxx> commit a078dff870136090b5779ca2831870a6c5539d36 upstream. Variable 'grp' may be left uninitialized if there's no group with suitable average fragment size (or larger). Fix the problem by initializing it earlier. Link: https://lore.kernel.org/r/20220922091542.pkhedytey7wzp5fi@quack3 Fixes: 83e80a6e3543 ("ext4: use buckets for cr 1 block scan instead of rbtree") Cc: stable@xxxxxxxxxx Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/mballoc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -910,7 +910,7 @@ static void ext4_mb_choose_next_group_cr int *new_cr, ext4_group_t *group, ext4_group_t ngroups) { struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); - struct ext4_group_info *grp, *iter; + struct ext4_group_info *grp = NULL, *iter; int i; if (unlikely(ac->ac_flags & EXT4_MB_CR1_OPTIMIZED)) { @@ -927,7 +927,6 @@ static void ext4_mb_choose_next_group_cr read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]); continue; } - grp = NULL; list_for_each_entry(iter, &sbi->s_mb_avg_fragment_size[i], bb_avg_fragment_size_node) { if (sbi->s_mb_stats) Patches currently in stable-queue which might be from jack@xxxxxxx are queue-5.19/ext4-avoid-unnecessary-spreading-of-allocations-among-groups.patch queue-5.19/ext4-use-buckets-for-cr-1-block-scan-instead-of-rbtree.patch queue-5.19/ext4-fix-bug-in-extents-parsing-when-eh_entries-0-and-eh_depth-0.patch queue-5.19/ext4-fixup-possible-uninitialized-variable-access-in-ext4_mb_choose_next_group_cr1.patch queue-5.19/ext4-make-mballoc-try-target-group-first-even-with-mb_optimize_scan.patch queue-5.19/ext4-use-locality-group-preallocation-for-small-closed-files.patch