[PATCH v2 09/11] ext4: iloc.bh cleanup in add_new_gdb()

From: Vasily Averin
Date: Tue Oct 30 2018 - 17:58:43 EST


iloc.bh was taken in ext4_reserve_inode_write() and released
in ext4_mark_iloc_dirty(). It should not be released 2nd time
in rollback after failed ext4_handle_dirty_metadata(gdb_bh)

Fixes b40971426a83 ("ext4: add error checking to calls to ...") # 2.6.38

Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx>
---
fs/ext4/resize.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 85158e9de7c2..aedfd6a6fcd1 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -871,7 +871,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh);
if (unlikely(err)) {
ext4_std_error(sb, err);
- goto exit_inode;
+ goto exit_kfree;
}
brelse(dind);

@@ -891,8 +891,9 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
return err;

exit_inode:
- kvfree(n_group_desc);
brelse(iloc.bh);
+exit_kfree:
+ kvfree(n_group_desc);
exit_dind:
brelse(dind);
exit_bh:
--
2.17.1