Re: [PATCH] ext4: add block bitmap validation

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

 



On Nov 19, 2007  20:26 +0530, Aneesh Kumar K.V wrote:
> +static int ext4_valid_block_bitmap(struct super_block *sb,
> +					struct ext4_group_desc *desc,
> +					unsigned int block_group,
> +					struct buffer_head *bh)
> +{
> +	if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
> +		/* with FLEX_BG, the inode/block bitmaps and itable
> +		 * blocks may not be in the group at all
> +		 * so the bitmap validation will be skipped for those groups
> +		 * or it has to also read the block group where the bitmaps
> +		 * are located to verify they are set.
> +		 */
> +		return 1;
> +	}

Rather than skipping the bitmap check entirely when FLEX_BG is enabled,
it is probably better to just validate whether each of the bitmap/itable
offsets are within the bitmap being read, like:

	offset = ...
	if (offset < EXT4_BLOCKS_PER_GROUP(sb) &&
	    ext4_test_bit(offset, bh->b_data))
		/* bad block bitmap */
	    	goto err_out;

Cheers, Andreas
--
Andreas Dilger
Sr. Software 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