ext4: ignore e_value_offs for xattrs with value-in-ea-inode

This change “ext4: ignore e_value_offs for xattrs with value-in-ea-inode” (commit e5d0119) in Linux kernel is authored by Theodore Ts'o <tytso [at] mit.edu> on Wed Apr 10 00:37:36 2019 -0400.

Description of "ext4: ignore e_value_offs for xattrs with value-in-ea-inode"

The change “ext4: ignore e_value_offs for xattrs with value-in-ea-inode” introduces changes as follows.

ext4: ignore e_value_offs for xattrs with value-in-ea-inode

In other places in fs/ext4/xattr.c, if e_value_inum is non-zero, the
code ignores the value in e_value_offs.  The e_value_offs *should* be
zero, but we shouldn't depend upon it, since it might not be true in a
corrupted/fuzzed file system.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202897
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202877
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org

Linux kernel releases containing commit e5d0119

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "ext4: ignore e_value_offs for xattrs with value-in-ea-inode"

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/ext4/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index dc82e7757f67..491f9ee4040e 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1696,7 +1696,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
 
 	/* No failures allowed past this point. */
 
-	if (!s->not_found && here->e_value_size && here->e_value_offs) {
+	if (!s->not_found && here->e_value_size && !here->e_value_inum) {
 		/* Remove the old value. */
 		void *first_val = s->base + min_offs;
 		size_t offs = le16_to_cpu(here->e_value_offs);

The commit for this change in Linux stable tree is e5d0119 (patch).

Last modified: 2020/02/08