diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index e9be0c0a8042..73b27ddafe91 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2892,6 +2892,8 @@ repeat: * from the goal value specified */ group = ac->ac_g_ex.fe_group; + if (group >= ngroups) + group = 0; ac->ac_groups_linear_remaining = sbi->s_mb_max_linear_groups; prefetch_grp = group;