summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaokun Li <libaokun1@huawei.com>2024-03-19 19:33:23 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-16 13:47:44 +0200
commitb0b47084f5d369e61d0750f1d7445e1e821ef482 (patch)
tree2f2b578788861af37f8fc330a9bb6722349f3242
parent3093e586b019c65b9975bb1ad0760c4273dce839 (diff)
downloadlinux-b0b47084f5d369e61d0750f1d7445e1e821ef482.tar.gz
linux-b0b47084f5d369e61d0750f1d7445e1e821ef482.tar.bz2
linux-b0b47084f5d369e61d0750f1d7445e1e821ef482.zip
ext4: set type of ac_groups_linear_remaining to __u32 to avoid overflow
commit 9a9f3a9842927e4af7ca10c19c94dad83bebd713 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: 196e402adf2e ("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>
-rw-r--r--fs/ext4/mballoc.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index d7aeb5da7d86..498af2abc5d8 100644
--- a/fs/ext4/mballoc.h
+++ b/fs/ext4/mballoc.h
@@ -194,8 +194,8 @@ struct ext4_allocation_context {
__u32 ac_groups_considered;
__u32 ac_flags; /* allocation hints */
+ __u32 ac_groups_linear_remaining;
__u16 ac_groups_scanned;
- __u16 ac_groups_linear_remaining;
__u16 ac_found;
__u16 ac_cX_found[EXT4_MB_NUM_CRS];
__u16 ac_tail;