From: Theodore Ts'o Date: Sun, 13 Jul 2008 23:03:59 +0000 (-0400) Subject: libext2fs: Don't check the group checksum when !GDT_CSUM X-Git-Tag: android-x86-6.0-r1~26^2~1294 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4729455f0a68f2fa0a83ec8460d1d4bccba9dcfa;p=android-x86%2Fexternal-e2fsprogs.git libext2fs: Don't check the group checksum when !GDT_CSUM ext2fs_group_desc_csum_verify() is always checking the bg_checksum (to make sure it is zero) even when the GDT_CSUM feature is not present. This is normally OK, but apparently there are filesystems in the wild where this field has not be initialized to zero. Addresses-Debian-Bug: #490637 Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c index ce1508e1..6a49d8f2 100644 --- a/lib/ext2fs/csum.c +++ b/lib/ext2fs/csum.c @@ -60,8 +60,10 @@ STATIC __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group) int ext2fs_group_desc_csum_verify(ext2_filsys fs, dgrp_t group) { - if (fs->group_desc[group].bg_checksum != - ext2fs_group_desc_csum(fs, group)) + if (EXT2_HAS_RO_COMPAT_FEATURE(fs->super, + EXT4_FEATURE_RO_COMPAT_GDT_CSUM) && + (fs->group_desc[group].bg_checksum != + ext2fs_group_desc_csum(fs, group))) return 0; return 1;