diff options
author | Nicolas Kaiser <nikai@nikai.net> | 2010-10-27 22:08:42 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-10-27 22:08:42 -0400 |
commit | beed5ecbaa377fa8bb6a54a6608e8725a21efdbc (patch) | |
tree | c8e76b2af5f0ccdc64d53907238947540de7d182 | |
parent | a6371b636f9f007ee5c90f85de048bc1b675424a (diff) |
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>
-rw-r--r-- | fs/ext4/super.c | 22 |
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, | |||
2902 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2902 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2903 | struct ext4_li_request *elr; | 2903 | struct ext4_li_request *elr; |
2904 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; | 2904 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; |
2905 | int ret = 0; | 2905 | int ret; |
2906 | 2906 | ||
2907 | if (sbi->s_li_request != NULL) | 2907 | if (sbi->s_li_request != NULL) |
2908 | goto out; | 2908 | return 0; |
2909 | 2909 | ||
2910 | if (first_not_zeroed == ngroups || | 2910 | if (first_not_zeroed == ngroups || |
2911 | (sb->s_flags & MS_RDONLY) || | 2911 | (sb->s_flags & MS_RDONLY) || |
2912 | !test_opt(sb, INIT_INODE_TABLE)) { | 2912 | !test_opt(sb, INIT_INODE_TABLE)) { |
2913 | sbi->s_li_request = NULL; | 2913 | sbi->s_li_request = NULL; |
2914 | goto out; | 2914 | return 0; |
2915 | } | 2915 | } |
2916 | 2916 | ||
2917 | if (first_not_zeroed == ngroups) { | 2917 | if (first_not_zeroed == ngroups) { |
2918 | sbi->s_li_request = NULL; | 2918 | sbi->s_li_request = NULL; |
2919 | goto out; | 2919 | return 0; |
2920 | } | 2920 | } |
2921 | 2921 | ||
2922 | elr = ext4_li_request_new(sb, first_not_zeroed); | 2922 | elr = ext4_li_request_new(sb, first_not_zeroed); |
2923 | if (!elr) { | 2923 | if (!elr) |
2924 | ret = -ENOMEM; | 2924 | return -ENOMEM; |
2925 | goto out; | ||
2926 | } | ||
2927 | 2925 | ||
2928 | mutex_lock(&ext4_li_mtx); | 2926 | mutex_lock(&ext4_li_mtx); |
2929 | 2927 | ||
@@ -2944,14 +2942,10 @@ static int ext4_register_li_request(struct super_block *sb, | |||
2944 | if (ret) | 2942 | if (ret) |
2945 | goto out; | 2943 | goto out; |
2946 | } | 2944 | } |
2947 | |||
2948 | mutex_unlock(&ext4_li_mtx); | ||
2949 | |||
2950 | out: | 2945 | out: |
2951 | if (ret) { | 2946 | mutex_unlock(&ext4_li_mtx); |
2952 | mutex_unlock(&ext4_li_mtx); | 2947 | if (ret) |
2953 | kfree(elr); | 2948 | kfree(elr); |
2954 | } | ||
2955 | return ret; | 2949 | return ret; |
2956 | } | 2950 | } |
2957 | 2951 | ||