Skip to content

Commit 8506b15

Browse files
LiBaokun96roxanan1996
authored andcommitted
ext4: set type of ac_groups_linear_remaining to __u32 to avoid overflow
BugLink: https://bugs.launchpad.net/bugs/2072617 commit 9a9f3a9 upstream. Now ac_groups_linear_remaining is of type __u16 and s_mb_max_linear_groups is of type unsigned int, so an overflow occurs when setting a value above 65535 through the mb_max_linear_groups sysfs interface. Therefore, the type of ac_groups_linear_remaining is set to __u32 to avoid overflow. Fixes: 196e402 ("ext4: improve cr 0 / cr 1 group scanning") CC: stable@kernel.org Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20240319113325.3110393-8-libaokun1@huawei.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Portia Stephens <portia.stephens@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 000ecf5 commit 8506b15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ext4/mballoc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ struct ext4_allocation_context {
181181
ext4_group_t ac_last_optimal_group;
182182
__u32 ac_groups_considered;
183183
__u32 ac_flags; /* allocation hints */
184+
__u32 ac_groups_linear_remaining;
184185
__u16 ac_groups_scanned;
185-
__u16 ac_groups_linear_remaining;
186186
__u16 ac_found;
187187
__u16 ac_tail;
188188
__u16 ac_buddy;

0 commit comments

Comments
 (0)