summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>2017-05-21 22:36:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-14 15:05:58 +0200
commit9890b9cb75c9f661546c81098ec49fbfc24abc9c (patch)
treece4dcce7e2ff4af385e179b6b5f82344b4d26291 /fs/ext4
parent9850844e0a0e6a7e419097aa545cc1f4e849d5ea (diff)
downloadlinux-stable-9890b9cb75c9f661546c81098ec49fbfc24abc9c.tar.gz
linux-stable-9890b9cb75c9f661546c81098ec49fbfc24abc9c.tar.bz2
linux-stable-9890b9cb75c9f661546c81098ec49fbfc24abc9c.zip
ext4: keep existing extra fields when inode expands
commit 887a9730614727c4fff7cb756711b190593fc1df upstream. ext4_expand_extra_isize() should clear only space between old and new size. Fixes: 6dd4ee7cab7e # v2.6.23 Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 01329688fb9e..6a6fa1fca8cf 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5441,8 +5441,9 @@ static int ext4_expand_extra_isize(struct inode *inode,
/* No extended attributes present */
if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) ||
header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) {
- memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE, 0,
- new_extra_isize);
+ memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +
+ EXT4_I(inode)->i_extra_isize, 0,
+ new_extra_isize - EXT4_I(inode)->i_extra_isize);
EXT4_I(inode)->i_extra_isize = new_extra_isize;
return 0;
}