From: Joseph Qi Date: Tue, 3 Nov 2020 02:29:02 +0000 (+0800) Subject: ext4: unlock xattr_sem properly in ext4_inline_data_truncate() X-Git-Tag: v4.4.244~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fbacd44844c614784d8a96e2aed1c197202ceba;p=thirdparty%2Fkernel%2Fstable.git 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 Cc: Tao Ma Signed-off-by: Joseph Qi Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/1604370542-124630-1-git-send-email-joseph.qi@linux.alibaba.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 00f9433eea23a..df585267d3c25 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -1892,6 +1892,7 @@ void 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;