add patch add-get_inode_usage-callback-to-transfer-multi-inode-charges
[ext4-patch-queue.git] / fix-ext4_xattr_cmp
blobf54c80d421782542aa9788bdc640e9407dde5e8b
1 ext4: fix ext4_xattr_cmp()
3 From: Tahsin Erdogan <tahsin@google.com>
5 When a xattr entry refers to an external inode, the value data is not
6 available in the inline area so we should not attempt to read it using
7 value offset.
9 Signed-off-by: Tahsin Erdogan <tahsin@google.com>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 ---
12  fs/ext4/xattr.c | 3 ++-
13  1 file changed, 2 insertions(+), 1 deletion(-)
15 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
16 index 9c243b3510b7..739f73a5a345 100644
17 --- a/fs/ext4/xattr.c
18 +++ b/fs/ext4/xattr.c
19 @@ -2169,7 +2169,8 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1,
20                     entry1->e_value_inum != entry2->e_value_inum ||
21                     memcmp(entry1->e_name, entry2->e_name, entry1->e_name_len))
22                         return 1;
23 -               if (memcmp((char *)header1 + le16_to_cpu(entry1->e_value_offs),
24 +               if (!entry1->e_value_inum &&
25 +                   memcmp((char *)header1 + le16_to_cpu(entry1->e_value_offs),
26                            (char *)header2 + le16_to_cpu(entry2->e_value_offs),
27                            le32_to_cpu(entry1->e_value_size)))
28                         return 1;
29 -- 
30 2.13.1.611.g7e3b11ae1-goog