diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-09 15:53:24 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-09 15:57:20 -0500 |
commit | 94bf608a18fa4421315275a81c5489734599297a (patch) | |
tree | 69b0022e0f47a5af7888c7e97459302373bfa338 /fs/ext4 | |
parent | 8fdd8c49fe50394fef3e193db27222cb03c2b212 (diff) |
ext4: fix failure exits
a) leaking root dentry is bad
b) in case of failed ext4_mb_init() we don't want to do ext4_mb_release()
c) OTOH, in the same case we *do* want ext4_ext_release()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/super.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 64e2529ae9bb..ed3ce82e2de4 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3733,10 +3733,12 @@ no_journal: | |||
3733 | } | 3733 | } |
3734 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { | 3734 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { |
3735 | ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); | 3735 | ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); |
3736 | iput(root); | ||
3736 | goto failed_mount4; | 3737 | goto failed_mount4; |
3737 | } | 3738 | } |
3738 | sb->s_root = d_alloc_root(root); | 3739 | sb->s_root = d_alloc_root(root); |
3739 | if (!sb->s_root) { | 3740 | if (!sb->s_root) { |
3741 | iput(root); | ||
3740 | ext4_msg(sb, KERN_ERR, "get root dentry failed"); | 3742 | ext4_msg(sb, KERN_ERR, "get root dentry failed"); |
3741 | ret = -ENOMEM; | 3743 | ret = -ENOMEM; |
3742 | goto failed_mount4; | 3744 | goto failed_mount4; |
@@ -3773,7 +3775,7 @@ no_journal: | |||
3773 | if (err) { | 3775 | if (err) { |
3774 | ext4_msg(sb, KERN_ERR, "failed to initialize system " | 3776 | ext4_msg(sb, KERN_ERR, "failed to initialize system " |
3775 | "zone (%d)", err); | 3777 | "zone (%d)", err); |
3776 | goto failed_mount4; | 3778 | goto failed_mount4a; |
3777 | } | 3779 | } |
3778 | 3780 | ||
3779 | ext4_ext_init(sb); | 3781 | ext4_ext_init(sb); |
@@ -3830,13 +3832,14 @@ cantfind_ext4: | |||
3830 | failed_mount7: | 3832 | failed_mount7: |
3831 | ext4_unregister_li_request(sb); | 3833 | ext4_unregister_li_request(sb); |
3832 | failed_mount6: | 3834 | failed_mount6: |
3833 | ext4_ext_release(sb); | ||
3834 | failed_mount5: | ||
3835 | ext4_mb_release(sb); | 3835 | ext4_mb_release(sb); |
3836 | failed_mount5: | ||
3837 | ext4_ext_release(sb); | ||
3836 | ext4_release_system_zone(sb); | 3838 | ext4_release_system_zone(sb); |
3837 | failed_mount4: | 3839 | failed_mount4a: |
3838 | iput(root); | 3840 | dput(sb->s_root); |
3839 | sb->s_root = NULL; | 3841 | sb->s_root = NULL; |
3842 | failed_mount4: | ||
3840 | ext4_msg(sb, KERN_ERR, "mount failed"); | 3843 | ext4_msg(sb, KERN_ERR, "mount failed"); |
3841 | destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq); | 3844 | destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq); |
3842 | failed_mount_wq: | 3845 | failed_mount_wq: |