ext4: fix xattr shifting when expanding inodes part 2
authorJan Kara <jack@suse.cz>
Thu, 11 Aug 2016 15:58:32 +0000 (11:58 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2016 06:27:50 +0000 (08:27 +0200)
commite6abdbf8ac4adc14b6e91fdeb81492c112e9cc1e
tree1225e48349829deef4e130f403a14c25ef941721
parentf2c06c7321aa080b18f36090cc1c3b2fa03a5cc8
ext4: fix xattr shifting when expanding inodes part 2

commit 418c12d08dc64a45107c467ec1ba29b5e69b0715 upstream.

When multiple xattrs need to be moved out of inode, we did not properly
recompute total size of xattr headers in the inode and the new header
position. Thus when moving the second and further xattr we asked
ext4_xattr_shift_entries() to move too much and from the wrong place,
resulting in possible xattr value corruption or general memory
corruption.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/xattr.c