[PATCH 4.14 153/161] ext4: unlock on error in ext4_expand_extra_isize()

From: Greg Kroah-Hartman
Date: Sun Dec 29 2019 - 12:27:13 EST


From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

commit 7f420d64a08c1dcd65b27be82a27cf2bdb2e7847 upstream.

We need to unlock the xattr before returning on this error path.

Cc: stable@xxxxxxxxxx # 4.13
Fixes: c03b45b853f5 ("ext4, project: expand inode extra size if possible")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20191213185010.6k7yl2tck3wlsdkt@xxxxxxxxxxxxx
Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
fs/ext4/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5874,7 +5874,7 @@ int ext4_expand_extra_isize(struct inode
error = ext4_journal_get_write_access(handle, iloc->bh);
if (error) {
brelse(iloc->bh);
- goto out_stop;
+ goto out_unlock;
}

error = __ext4_expand_extra_isize(inode, new_extra_isize, iloc,
@@ -5884,8 +5884,8 @@ int ext4_expand_extra_isize(struct inode
if (!error)
error = rc;

+out_unlock:
ext4_write_unlock_xattr(inode, &no_expand);
-out_stop:
ext4_journal_stop(handle);
return error;
}