]> 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)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Sep 2025 10:03:48 +0000 (12:03 +0200)
Signed-off-by: 胡玮文 <huweiwen.hww@alibaba-inc.com>
(cherry picked from commit 0c5d55e52d27be933e9e61b82bd386943bd9e05c)

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);