summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorNicolas Kaiser <nikai@nikai.net>2010-10-28 04:08:42 +0200
committerTheodore Ts'o <tytso@mit.edu>2010-10-28 04:08:42 +0200
commitbeed5ecbaa377fa8bb6a54a6608e8725a21efdbc (patch)
treec8e76b2af5f0ccdc64d53907238947540de7d182 /fs/ext4
parentext4: fix compile error in ext4_fallocate() (diff)
downloadlinux-beed5ecbaa377fa8bb6a54a6608e8725a21efdbc.tar.xz
linux-beed5ecbaa377fa8bb6a54a6608e8725a21efdbc.zip
ext4: fix unbalanced mutex unlock in error path of ext4_li_request_new
Signed-off-by: Nicolas Kaiser <nikai@nikai.net> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/super.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 158d1bca8769..3b4984d37a68 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2902,28 +2902,26 @@ static int ext4_register_li_request(struct super_block *sb,
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_li_request *elr;
ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
- int ret = 0;
+ int ret;
if (sbi->s_li_request != NULL)
- goto out;
+ return 0;
if (first_not_zeroed == ngroups ||
(sb->s_flags & MS_RDONLY) ||
!test_opt(sb, INIT_INODE_TABLE)) {
sbi->s_li_request = NULL;
- goto out;
+ return 0;
}
if (first_not_zeroed == ngroups) {
sbi->s_li_request = NULL;
- goto out;
+ return 0;
}
elr = ext4_li_request_new(sb, first_not_zeroed);
- if (!elr) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!elr)
+ return -ENOMEM;
mutex_lock(&ext4_li_mtx);
@@ -2944,14 +2942,10 @@ static int ext4_register_li_request(struct super_block *sb,
if (ret)
goto out;
}
-
- mutex_unlock(&ext4_li_mtx);
-
out:
- if (ret) {
- mutex_unlock(&ext4_li_mtx);
+ mutex_unlock(&ext4_li_mtx);
+ if (ret)
kfree(elr);
- }
return ret;
}