ext4: Check that external xattr value block is zero
authorJan Kara <jack@suse.cz>
Mon, 29 Aug 2016 19:39:11 +0000 (15:39 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 29 Aug 2016 19:39:11 +0000 (15:39 -0400)
Currently we don't support xattrs with values stored out of line. Check
for that in ext4_xattr_check_names() to make sure we never work with
such xattrs since not all the code counts with that resulting is possible
weird corruption issues.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/xattr.c

index 22d2ebcd1f09092bd0d89b933f45448d6959b4bf..f845cb7c6623be29f5c6406df125fde1eb760f8c 100644 (file)
@@ -199,6 +199,8 @@ ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end,
        }
 
        while (!IS_LAST_ENTRY(entry)) {
+               if (entry->e_value_block != 0)
+                       return -EFSCORRUPTED;
                if (entry->e_value_size != 0 &&
                    (value_start + le16_to_cpu(entry->e_value_offs) <
                     (void *)e + sizeof(__u32) ||