Skip to content

Commit 9129151

Browse files
dinghaoliugregkh
authored andcommitted
ext4: fix error handling code in add_new_gdb
commit c9e8716 upstream. When ext4_journal_get_write_access() fails, we should terminate the execution flow and release n_group_desc, iloc.bh, dind and gdb_bh. Cc: [email protected] Signed-off-by: Dinghao Liu <[email protected]> Reviewed-by: Andreas Dilger <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5802528 commit 9129151

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/ext4/resize.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,10 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
843843

844844
BUFFER_TRACE(dind, "get_write_access");
845845
err = ext4_journal_get_write_access(handle, dind);
846-
if (unlikely(err))
846+
if (unlikely(err)) {
847847
ext4_std_error(sb, err);
848+
goto errout;
849+
}
848850

849851
/* ext4_reserve_inode_write() gets a reference on the iloc */
850852
err = ext4_reserve_inode_write(handle, inode, &iloc);

0 commit comments

Comments
 (0)