Re: [PATCH] libext2fs: use ext2fs_blocks_count() in ext2fs_open2()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sep 01, 2009  16:43 -0500, Eric Sandeen wrote:
> ext2fs_open2() was only looking at s_blocks_count, and
> when it wrapped to a low number, it was failing the test of:
> 
>   fs->super->s_first_data_block >= fs->super->s_blocks_count
> 
> which made the superblock look corrupt.

Is this the source of the "e2fsck is finding bad checksums" problem?

> Patch is against the pu branch
> 
> Index: e2fsprogs/lib/ext2fs/openfs.c
> ===================================================================
> --- e2fsprogs.orig/lib/ext2fs/openfs.c
> +++ e2fsprogs/lib/ext2fs/openfs.c
> @@ -288,7 +288,7 @@ errcode_t ext2fs_open2(const char *name,
>  	    blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) ||
>  	    fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super) ||
>             EXT2_DESC_PER_BLOCK(fs->super) == 0 ||
> -           fs->super->s_first_data_block >= fs->super->s_blocks_count) {
> +           fs->super->s_first_data_block >= ext2fs_blocks_count(fs->super)) {

I would strongly suggest to replace the declaration of "s_blocks_count"
with "s_blocks_count_lo" (and similar for every other split value), so
that we catch all instances of this type of bug.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux