Skip to content

Commit

Permalink
ext4: fix error handling code in add_new_gdb
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dinghaoliu authored and gregkh committed Nov 5, 2020
1 parent 5802528 commit 9129151
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ext4/resize.c
Expand Up @@ -843,8 +843,10 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,

BUFFER_TRACE(dind, "get_write_access");
err = ext4_journal_get_write_access(handle, dind);
if (unlikely(err))
if (unlikely(err)) {
ext4_std_error(sb, err);
goto errout;
}

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

0 comments on commit 9129151

Please sign in to comment.