[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <20090603181608.GO9002@webber.adilger.int>
Date: Wed, 03 Jun 2009 12:16:08 -0600
From: Andreas Dilger <adilger@....com>
To: "Theodore Ts'o" <tytso@....edu>
Cc: linux-ext4@...r.kernel.org
Subject: Re: Fix softlockup caused by illegal i_file_acl value in on-disk inode
On Jun 02, 2009 08:07 -0400, Theodore Ts'o wrote:
> + if (ei->i_file_acl &&
> + ((ei->i_file_acl <
> + (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
> + EXT4_SB(sb)->s_gdb_count)) ||
> + (ei->i_file_acl >= ext4_blocks_count(EXT4_SB(sb)->s_es)))) {
I was just thinking it might make sense to wrap this check into a helper
like the following. We check the validity of blocks in at least half a
dozen different places. The elaborate ext4_blocktype is to allow for
future expansion of this checking mechanism to allow it to check for
blocks overlapping with e.g. the inode table and such, and possibly for
using with the jbd2 buffer checksum mechanism at some later date.
enum ext4_blocktype {
EXT4_BT_SUPERBLOCK = 1,
EXT4_BT_GDT = 2,
EXT4_BT_INODE_BITMAP = 3,
EXT4_BT_BLOCK_BITMAP = 4,
EXT4_BT_INODE_TABLE = 5,
EXT4_BT_DIRECTORY_ROOT = 10,
EXT4_BT_DIRECTORY_LEAF = 11,
EXT4_BT_DIRECTORY_HTREE = 12,
EXT4_BT_INDIRECT = 21,
EXT4_BT_DINDIRECT = 22,
EXT4_BT_TINDIRECT = 23,
EXT4_BT_EXTENT_INDEX = 25,
EXT4_BT_EXTENT_LEAF = 26,
EXT4_BT_DATA_BLOCK = 30,
EXT4_BT_ACL_BLOCK = 31,
};
bool ext4_block_valid(ext4_blk_t block, enum blocktype)
{
if (block < le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
EXT4_SB(sb)->s_gdb_count)) ||
block >= ext4_blocks_count(EXT4_SB(sb)->s_es)
return 0;
return 1;
}
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists