提交 beed5ecb 编写于 作者: N Nicolas Kaiser 提交者: Theodore Ts'o

ext4: fix unbalanced mutex unlock in error path of ext4_li_request_new

Signed-off-by: NNicolas Kaiser <nikai@nikai.net>
Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 a6371b63
无相关合并请求
...@@ -2902,28 +2902,26 @@ static int ext4_register_li_request(struct super_block *sb, ...@@ -2902,28 +2902,26 @@ static int ext4_register_li_request(struct super_block *sb,
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_li_request *elr; struct ext4_li_request *elr;
ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
int ret = 0; int ret;
if (sbi->s_li_request != NULL) if (sbi->s_li_request != NULL)
goto out; return 0;
if (first_not_zeroed == ngroups || if (first_not_zeroed == ngroups ||
(sb->s_flags & MS_RDONLY) || (sb->s_flags & MS_RDONLY) ||
!test_opt(sb, INIT_INODE_TABLE)) { !test_opt(sb, INIT_INODE_TABLE)) {
sbi->s_li_request = NULL; sbi->s_li_request = NULL;
goto out; return 0;
} }
if (first_not_zeroed == ngroups) { if (first_not_zeroed == ngroups) {
sbi->s_li_request = NULL; sbi->s_li_request = NULL;
goto out; return 0;
} }
elr = ext4_li_request_new(sb, first_not_zeroed); elr = ext4_li_request_new(sb, first_not_zeroed);
if (!elr) { if (!elr)
ret = -ENOMEM; return -ENOMEM;
goto out;
}
mutex_lock(&ext4_li_mtx); mutex_lock(&ext4_li_mtx);
...@@ -2944,14 +2942,10 @@ static int ext4_register_li_request(struct super_block *sb, ...@@ -2944,14 +2942,10 @@ static int ext4_register_li_request(struct super_block *sb,
if (ret) if (ret)
goto out; goto out;
} }
mutex_unlock(&ext4_li_mtx);
out: out:
if (ret) {
mutex_unlock(&ext4_li_mtx); mutex_unlock(&ext4_li_mtx);
if (ret)
kfree(elr); kfree(elr);
}
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部