]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: (ext) reduce false positive
author胡玮文 <huweiwen.hww@alibaba-inc.com>
Mon, 28 Jul 2025 06:32:13 +0000 (14:32 +0800)
committer胡玮文 <huweiwen.hww@alibaba-inc.com>
Mon, 28 Jul 2025 06:57:05 +0000 (14:57 +0800)
Signed-off-by: 胡玮文 <huweiwen.hww@alibaba-inc.com>
libblkid/src/superblocks/ext.c

index c0779c2333b306dbdac20bf6406b9aa357929613..ab4d7a8274c24be023b8db39ed0a967d6ecaed0a 100644 (file)
@@ -180,6 +180,15 @@ static struct ext2_super_block *ext_get_super(
                        return NULL;
 #endif
                }
+       } else {
+               /*
+                * For legacy fs without checksum, additionally verify the
+                * block size to reduce false positive. Currently max allowed
+                * block size is 64KiB (s_log_block_size <= 6), check for 256
+                * to be more future proof.
+                */
+               if (le32_to_cpu(es->s_log_block_size) >= 256)
+                       return NULL;
        }
        if (fc)
                *fc = le32_to_cpu(es->s_feature_compat);