1 ext4: always verify the magic number in xattr blocks
3 If there an inode points to a block which is also some other type of
4 metadata block (such as a block allocation bitmap), the
5 buffer_verified flag can be set when it was validated as that other
6 metadata block type; however, it would make a really terrible external
7 attribute block. The reason why we use the verified flag is to avoid
8 constantly reverifying the block. However, it doesn't take much
9 overhead to make sure the magic number of the xattr block is correct,
10 and this will avoid potential crashes.
12 https://bugzilla.kernel.org/show_bug.cgi?id=200001
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 Reviewed-by: Andreas Dilger <adilger@dilger.ca>
17 fs/ext4/xattr.c | 6 +++---
18 1 file changed, 3 insertions(+), 3 deletions(-)
20 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
21 index 230ba79715f6..0263692979ec 100644
24 @@ -230,12 +230,12 @@ __ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh,
26 int error = -EFSCORRUPTED;
28 - if (buffer_verified(bh))
31 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) ||
32 BHDR(bh)->h_blocks != cpu_to_le32(1))
34 + if (buffer_verified(bh))
38 if (!ext4_xattr_block_csum_verify(inode, bh))