提交 d1c6a6f8 编写于 作者: S Shijie Luo 提交者: Cheng Jian

ext4: fix potential error in ext4_do_update_inode

mainline inclusion
from mainline-v5.12-rc4
commit 7d8bd3c7
category: bugfix
bugzilla: 51135
CVE: NA

-----------------------------------------------

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: NShijie Luo <luoshijie1@huawei.com>
Link: https://lore.kernel.org/r/20210312065051.36314-1-luoshijie1@huawei.com
Cc: stable@kernel.org
Reviewed-by: NJan Kara <jack@suse.cz>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
Signed-off-by: NZhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 48574241
...@@ -5282,7 +5282,7 @@ static int ext4_do_update_inode(handle_t *handle, ...@@ -5282,7 +5282,7 @@ static int ext4_do_update_inode(handle_t *handle,
struct ext4_inode_info *ei = EXT4_I(inode); struct ext4_inode_info *ei = EXT4_I(inode);
struct buffer_head *bh = iloc->bh; struct buffer_head *bh = iloc->bh;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
int err = 0, rc, block; int err = 0, block;
int need_datasync = 0, set_large_file = 0; int need_datasync = 0, set_large_file = 0;
uid_t i_uid; uid_t i_uid;
gid_t i_gid; gid_t i_gid;
...@@ -5394,9 +5394,9 @@ static int ext4_do_update_inode(handle_t *handle, ...@@ -5394,9 +5394,9 @@ static int ext4_do_update_inode(handle_t *handle,
bh->b_data); bh->b_data);
BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
rc = ext4_handle_dirty_metadata(handle, NULL, bh); err = ext4_handle_dirty_metadata(handle, NULL, bh);
if (!err) if (err)
err = rc; goto out_brelse;
ext4_clear_inode_state(inode, EXT4_STATE_NEW); ext4_clear_inode_state(inode, EXT4_STATE_NEW);
if (set_large_file) { if (set_large_file) {
BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access"); BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册