Skip to content

Commit 7d8bd3c

Browse files
Shijie Luotytso
authored andcommitted
ext4: fix potential error in ext4_do_update_inode
If set_large_file = 1 and errors occur in ext4_handle_dirty_metadata(), the error code will be overridden, go to out_brelse to avoid this situation. Signed-off-by: Shijie Luo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 6b22489 commit 7d8bd3c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/ext4/inode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5026,7 +5026,7 @@ static int ext4_do_update_inode(handle_t *handle,
50265026
struct ext4_inode_info *ei = EXT4_I(inode);
50275027
struct buffer_head *bh = iloc->bh;
50285028
struct super_block *sb = inode->i_sb;
5029-
int err = 0, rc, block;
5029+
int err = 0, block;
50305030
int need_datasync = 0, set_large_file = 0;
50315031
uid_t i_uid;
50325032
gid_t i_gid;
@@ -5138,9 +5138,9 @@ static int ext4_do_update_inode(handle_t *handle,
51385138
bh->b_data);
51395139

51405140
BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
5141-
rc = ext4_handle_dirty_metadata(handle, NULL, bh);
5142-
if (!err)
5143-
err = rc;
5141+
err = ext4_handle_dirty_metadata(handle, NULL, bh);
5142+
if (err)
5143+
goto out_brelse;
51445144
ext4_clear_inode_state(inode, EXT4_STATE_NEW);
51455145
if (set_large_file) {
51465146
BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access");

0 commit comments

Comments
 (0)