add patch fix-memory-leak-when-symlink-decryption-fails
[ext4-patch-queue.git] / check-that-external-xattr-value-block-is-zero
blob8691181fa04724316b6c86ff7877cb513c7f2a9c
1 ext4: Check that external xattr value block is zero
3 From: Jan Kara <jack@suse.cz>
5 Currently we don't support xattrs with values stored out of line. Check
6 for that in ext4_xattr_check_names() to make sure we never work with
7 such xattrs since not all the code counts with that resulting is possible
8 weird corruption issues.
10 Signed-off-by: Jan Kara <jack@suse.cz>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 ---
13  fs/ext4/xattr.c | 2 ++
14  1 file changed, 2 insertions(+)
16 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
17 index 22d2ebcd1f09..f845cb7c6623 100644
18 --- a/fs/ext4/xattr.c
19 +++ b/fs/ext4/xattr.c
20 @@ -199,6 +199,8 @@ ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end,
21         }
23         while (!IS_LAST_ENTRY(entry)) {
24 +               if (entry->e_value_block != 0)
25 +                       return -EFSCORRUPTED;
26                 if (entry->e_value_size != 0 &&
27                     (value_start + le16_to_cpu(entry->e_value_offs) <
28                      (void *)e + sizeof(__u32) ||
29 -- 
30 2.6.6