Skip to content

Commit 1fcbcf0

Browse files
cgxu519jankara
authored andcommitted
ext2: fix improper assignment for e_value_offs
In the process of changing value for existing EA, there is an improper assignment of e_value_offs(setting to 0), because it will be reset to incorrect value in the following loop(shifting EA values before target). Delayed assignment can avoid this issue. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Chengguang Xu <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent 0bddd22 commit 1fcbcf0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ext2/xattr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
588588
/* Remove the old value. */
589589
memmove(first_val + size, first_val, val - first_val);
590590
memset(first_val, 0, size);
591-
here->e_value_offs = 0;
592591
min_offs += size;
593592

594593
/* Adjust all value offsets. */
@@ -600,6 +599,8 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
600599
cpu_to_le16(o + size);
601600
last = EXT2_XATTR_NEXT(last);
602601
}
602+
603+
here->e_value_offs = 0;
603604
}
604605
if (value == NULL) {
605606
/* Remove the old name. */

0 commit comments

Comments
 (0)