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>
This commit is contained in:
parent
8fdd8c49fe
commit
94bf608a18
1 changed files with 8 additions and 5 deletions
|
@ -3733,10 +3733,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
}
|
}
|
||||||
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
|
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
|
||||||
ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck");
|
ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck");
|
||||||
|
iput(root);
|
||||||
goto failed_mount4;
|
goto failed_mount4;
|
||||||
}
|
}
|
||||||
sb->s_root = d_alloc_root(root);
|
sb->s_root = d_alloc_root(root);
|
||||||
if (!sb->s_root) {
|
if (!sb->s_root) {
|
||||||
|
iput(root);
|
||||||
ext4_msg(sb, KERN_ERR, "get root dentry failed");
|
ext4_msg(sb, KERN_ERR, "get root dentry failed");
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto failed_mount4;
|
goto failed_mount4;
|
||||||
|
@ -3773,7 +3775,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
if (err) {
|
if (err) {
|
||||||
ext4_msg(sb, KERN_ERR, "failed to initialize system "
|
ext4_msg(sb, KERN_ERR, "failed to initialize system "
|
||||||
"zone (%d)", err);
|
"zone (%d)", err);
|
||||||
goto failed_mount4;
|
goto failed_mount4a;
|
||||||
}
|
}
|
||||||
|
|
||||||
ext4_ext_init(sb);
|
ext4_ext_init(sb);
|
||||||
|
@ -3830,13 +3832,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
failed_mount7:
|
failed_mount7:
|
||||||
ext4_unregister_li_request(sb);
|
ext4_unregister_li_request(sb);
|
||||||
failed_mount6:
|
failed_mount6:
|
||||||
ext4_ext_release(sb);
|
|
||||||
failed_mount5:
|
|
||||||
ext4_mb_release(sb);
|
ext4_mb_release(sb);
|
||||||
|
failed_mount5:
|
||||||
|
ext4_ext_release(sb);
|
||||||
ext4_release_system_zone(sb);
|
ext4_release_system_zone(sb);
|
||||||
failed_mount4:
|
failed_mount4a:
|
||||||
iput(root);
|
dput(sb->s_root);
|
||||||
sb->s_root = NULL;
|
sb->s_root = NULL;
|
||||||
|
failed_mount4:
|
||||||
ext4_msg(sb, KERN_ERR, "mount failed");
|
ext4_msg(sb, KERN_ERR, "mount failed");
|
||||||
destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq);
|
destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq);
|
||||||
failed_mount_wq:
|
failed_mount_wq:
|
||||||
|
|
Loading…
Reference in a new issue