diff options
-rw-r--r-- | security/selinux/selinuxfs.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 973f5a4a6fce..fde4e9d64bfd 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
29 | #include <linux/audit.h> | 29 | #include <linux/audit.h> |
30 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
31 | #include <linux/kobject.h> | ||
31 | 32 | ||
32 | /* selinuxfs pseudo filesystem for exporting the security policy API. | 33 | /* selinuxfs pseudo filesystem for exporting the security policy API. |
33 | Based on the proc code and the fs/nfsd/nfsctl.c code. */ | 34 | Based on the proc code and the fs/nfsd/nfsctl.c code. */ |
@@ -1909,6 +1910,7 @@ static struct file_system_type sel_fs_type = { | |||
1909 | }; | 1910 | }; |
1910 | 1911 | ||
1911 | struct vfsmount *selinuxfs_mount; | 1912 | struct vfsmount *selinuxfs_mount; |
1913 | static struct kobject *selinuxfs_kobj; | ||
1912 | 1914 | ||
1913 | static int __init init_sel_fs(void) | 1915 | static int __init init_sel_fs(void) |
1914 | { | 1916 | { |
@@ -1916,9 +1918,16 @@ static int __init init_sel_fs(void) | |||
1916 | 1918 | ||
1917 | if (!selinux_enabled) | 1919 | if (!selinux_enabled) |
1918 | return 0; | 1920 | return 0; |
1921 | |||
1922 | selinuxfs_kobj = kobject_create_and_add("selinux", fs_kobj); | ||
1923 | if (!selinuxfs_kobj) | ||
1924 | return -ENOMEM; | ||
1925 | |||
1919 | err = register_filesystem(&sel_fs_type); | 1926 | err = register_filesystem(&sel_fs_type); |
1920 | if (err) | 1927 | if (err) { |
1928 | kobject_put(selinuxfs_kobj); | ||
1921 | return err; | 1929 | return err; |
1930 | } | ||
1922 | 1931 | ||
1923 | selinuxfs_mount = kern_mount(&sel_fs_type); | 1932 | selinuxfs_mount = kern_mount(&sel_fs_type); |
1924 | if (IS_ERR(selinuxfs_mount)) { | 1933 | if (IS_ERR(selinuxfs_mount)) { |
@@ -1935,6 +1944,7 @@ __initcall(init_sel_fs); | |||
1935 | #ifdef CONFIG_SECURITY_SELINUX_DISABLE | 1944 | #ifdef CONFIG_SECURITY_SELINUX_DISABLE |
1936 | void exit_sel_fs(void) | 1945 | void exit_sel_fs(void) |
1937 | { | 1946 | { |
1947 | kobject_put(selinuxfs_kobj); | ||
1938 | unregister_filesystem(&sel_fs_type); | 1948 | unregister_filesystem(&sel_fs_type); |
1939 | } | 1949 | } |
1940 | #endif | 1950 | #endif |