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: stable@kernel.org Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Link: https://lore.kernel.org/r/20200829025403.3139-1-dinghao.liu@zju.edu.cn Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5802528 commit 9129151

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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)