hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/ext2/super.c
....@@ -673,10 +673,9 @@
673673 es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT);
674674 le16_add_cpu(&es->s_mnt_count, 1);
675675 if (test_opt (sb, DEBUG))
676
- ext2_msg(sb, KERN_INFO, "%s, %s, bs=%lu, fs=%lu, gc=%lu, "
676
+ ext2_msg(sb, KERN_INFO, "%s, %s, bs=%lu, gc=%lu, "
677677 "bpg=%lu, ipg=%lu, mo=%04lx]",
678678 EXT2FS_VERSION, EXT2FS_DATE, sb->s_blocksize,
679
- sbi->s_frag_size,
680679 sbi->s_groups_count,
681680 EXT2_BLOCKS_PER_GROUP(sb),
682681 EXT2_INODES_PER_GROUP(sb),
....@@ -950,6 +949,13 @@
950949 goto failed_mount;
951950 }
952951
952
+ if (le32_to_cpu(es->s_log_block_size) >
953
+ (EXT2_MAX_BLOCK_LOG_SIZE - BLOCK_SIZE_BITS)) {
954
+ ext2_msg(sb, KERN_ERR,
955
+ "Invalid log block size: %u",
956
+ le32_to_cpu(es->s_log_block_size));
957
+ goto failed_mount;
958
+ }
953959 blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
954960
955961 if (test_opt(sb, DAX)) {
....@@ -1007,14 +1013,7 @@
10071013 }
10081014 }
10091015
1010
- sbi->s_frag_size = EXT2_MIN_FRAG_SIZE <<
1011
- le32_to_cpu(es->s_log_frag_size);
1012
- if (sbi->s_frag_size == 0)
1013
- goto cantfind_ext2;
1014
- sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size;
1015
-
10161016 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
1017
- sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group);
10181017 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
10191018
10201019 sbi->s_inodes_per_block = sb->s_blocksize / EXT2_INODE_SIZE(sb);
....@@ -1040,11 +1039,10 @@
10401039 goto failed_mount;
10411040 }
10421041
1043
- if (sb->s_blocksize != sbi->s_frag_size) {
1042
+ if (es->s_log_frag_size != es->s_log_block_size) {
10441043 ext2_msg(sb, KERN_ERR,
1045
- "error: fragsize %lu != blocksize %lu"
1046
- "(not supported yet)",
1047
- sbi->s_frag_size, sb->s_blocksize);
1044
+ "error: fragsize log %u != blocksize log %u",
1045
+ le32_to_cpu(es->s_log_frag_size), sb->s_blocksize_bits);
10481046 goto failed_mount;
10491047 }
10501048
....@@ -1052,12 +1050,6 @@
10521050 ext2_msg(sb, KERN_ERR,
10531051 "error: #blocks per group too big: %lu",
10541052 sbi->s_blocks_per_group);
1055
- goto failed_mount;
1056
- }
1057
- if (sbi->s_frags_per_group > sb->s_blocksize * 8) {
1058
- ext2_msg(sb, KERN_ERR,
1059
- "error: #fragments per group too big: %lu",
1060
- sbi->s_frags_per_group);
10611053 goto failed_mount;
10621054 }
10631055 if (sbi->s_inodes_per_group < sbi->s_inodes_per_block ||