From: 胡玮文 Date: Mon, 28 Jul 2025 06:32:13 +0000 (+0800) Subject: libblkid: (ext) reduce false positive X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c5d55e52d27be933e9e61b82bd386943bd9e05c;p=thirdparty%2Futil-linux.git libblkid: (ext) reduce false positive Signed-off-by: 胡玮文 --- diff --git a/libblkid/src/superblocks/ext.c b/libblkid/src/superblocks/ext.c index c0779c233..ab4d7a827 100644 --- a/libblkid/src/superblocks/ext.c +++ b/libblkid/src/superblocks/ext.c @@ -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);