aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs/main.c')
-rw-r--r--fs/ecryptfs/main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index e557a6766927..a98497264fe8 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -813,6 +813,15 @@ out:
813 return rc; 813 return rc;
814} 814}
815 815
816static void do_sysfs_unregistration(void)
817{
818 sysfs_remove_file(&ecryptfs_subsys.kobj,
819 &sysfs_attr_version.attr);
820 sysfs_remove_file(&ecryptfs_subsys.kobj,
821 &sysfs_attr_version_str.attr);
822 subsystem_unregister(&ecryptfs_subsys);
823}
824
816static int __init ecryptfs_init(void) 825static int __init ecryptfs_init(void)
817{ 826{
818 int rc; 827 int rc;
@@ -851,6 +860,9 @@ static int __init ecryptfs_init(void)
851 if (rc) { 860 if (rc) {
852 ecryptfs_printk(KERN_ERR, "Failure occured while attempting to " 861 ecryptfs_printk(KERN_ERR, "Failure occured while attempting to "
853 "initialize the eCryptfs netlink socket\n"); 862 "initialize the eCryptfs netlink socket\n");
863 do_sysfs_unregistration();
864 unregister_filesystem(&ecryptfs_fs_type);
865 ecryptfs_free_kmem_caches();
854 } 866 }
855out: 867out:
856 return rc; 868 return rc;
@@ -858,11 +870,7 @@ out:
858 870
859static void __exit ecryptfs_exit(void) 871static void __exit ecryptfs_exit(void)
860{ 872{
861 sysfs_remove_file(&ecryptfs_subsys.kobj, 873 do_sysfs_unregistration();
862 &sysfs_attr_version.attr);
863 sysfs_remove_file(&ecryptfs_subsys.kobj,
864 &sysfs_attr_version_str.attr);
865 subsystem_unregister(&ecryptfs_subsys);
866 ecryptfs_release_messaging(ecryptfs_transport); 874 ecryptfs_release_messaging(ecryptfs_transport);
867 unregister_filesystem(&ecryptfs_fs_type); 875 unregister_filesystem(&ecryptfs_fs_type);
868 ecryptfs_free_kmem_caches(); 876 ecryptfs_free_kmem_caches();