summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoseph Qi <joseph.qi@linux.alibaba.com>2020-11-03 10:29:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-18 19:18:48 +0100
commit9d9ad220bb414da6e8b6ae0e35f9e4db976a97ef (patch)
tree8e351c7dfd9aa526acad185598ce4853f70cfbe5 /fs
parentf0bb30a1fc8fe0d9a3068c7cf1644302c8196cfc (diff)
downloadlinux-stable-9d9ad220bb414da6e8b6ae0e35f9e4db976a97ef.tar.gz
linux-stable-9d9ad220bb414da6e8b6ae0e35f9e4db976a97ef.tar.bz2
linux-stable-9d9ad220bb414da6e8b6ae0e35f9e4db976a97ef.zip
ext4: unlock xattr_sem properly in ext4_inline_data_truncate()
commit 7067b2619017d51e71686ca9756b454de0e5826a upstream. It takes xattr_sem to check inline data again but without unlock it in case not have. So unlock it before return. Fixes: aef1c8513c1f ("ext4: let ext4_truncate handle inline data correctly") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Tao Ma <boyu.mt@taobao.com> Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Link: https://lore.kernel.org/r/1604370542-124630-1-git-send-email-joseph.qi@linux.alibaba.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/inline.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 4572cb057951..c95246187659 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1921,6 +1921,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline)
ext4_write_lock_xattr(inode, &no_expand);
if (!ext4_has_inline_data(inode)) {
+ ext4_write_unlock_xattr(inode, &no_expand);
*has_inline = 0;
ext4_journal_stop(handle);
return 0;