Skip to content

Commit 0794f56

Browse files
author
Al Viro
committed
ecryptfs: make register_filesystem() the last potential failure exit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent f4c5499 commit 0794f56

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎fs/ecryptfs/main.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -794,15 +794,10 @@ static int __init ecryptfs_init(void)
794794
"Failed to allocate one or more kmem_cache objects\n");
795795
goto out;
796796
}
797-
rc = register_filesystem(&ecryptfs_fs_type);
798-
if (rc) {
799-
printk(KERN_ERR "Failed to register filesystem\n");
800-
goto out_free_kmem_caches;
801-
}
802797
rc = do_sysfs_registration();
803798
if (rc) {
804799
printk(KERN_ERR "sysfs registration failed\n");
805-
goto out_unregister_filesystem;
800+
goto out_free_kmem_caches;
806801
}
807802
rc = ecryptfs_init_kthread();
808803
if (rc) {
@@ -823,19 +818,24 @@ static int __init ecryptfs_init(void)
823818
"rc = [%d]\n", rc);
824819
goto out_release_messaging;
825820
}
821+
rc = register_filesystem(&ecryptfs_fs_type);
822+
if (rc) {
823+
printk(KERN_ERR "Failed to register filesystem\n");
824+
goto out_destroy_crypto;
825+
}
826826
if (ecryptfs_verbosity > 0)
827827
printk(KERN_CRIT "eCryptfs verbosity set to %d. Secret values "
828828
"will be written to the syslog!\n", ecryptfs_verbosity);
829829

830830
goto out;
831+
out_destroy_crypto:
832+
ecryptfs_destroy_crypto();
831833
out_release_messaging:
832834
ecryptfs_release_messaging();
833835
out_destroy_kthread:
834836
ecryptfs_destroy_kthread();
835837
out_do_sysfs_unregistration:
836838
do_sysfs_unregistration();
837-
out_unregister_filesystem:
838-
unregister_filesystem(&ecryptfs_fs_type);
839839
out_free_kmem_caches:
840840
ecryptfs_free_kmem_caches();
841841
out:

0 commit comments

Comments
 (0)