add patch export-sysfs-casefold-feature-attribute
[ext4-patch-queue.git] / ignore-e_value_offs-for-ea-with-value-in-inode
blob2740570519c6eacc09517ed11104495f7912f8e0
1 ext4: ignore e_value_offs for xattrs with value-in-ea-inode
3 In other places in fs/ext4/xattr.c, if e_value_inum is non-zero, the
4 code ignores the value in e_value_offs.  The e_value_offs *should* be
5 zero, but we shouldn't depend upon it, since it might not be true in a
6 corrupted/fuzzed file system.
8 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202897
9 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202877
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 Cc: stable@kernel.org
12 ---
13  fs/ext4/xattr.c | 2 +-
14  1 file changed, 1 insertion(+), 1 deletion(-)
16 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
17 index dc82e7757f67..491f9ee4040e 100644
18 --- a/fs/ext4/xattr.c
19 +++ b/fs/ext4/xattr.c
20 @@ -1696,7 +1696,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
22         /* No failures allowed past this point. */
24 -       if (!s->not_found && here->e_value_size && here->e_value_offs) {
25 +       if (!s->not_found && here->e_value_size && !here->e_value_inum) {
26                 /* Remove the old value. */
27                 void *first_val = s->base + min_offs;
28                 size_t offs = le16_to_cpu(here->e_value_offs);