]> Git Repo - linux.git/commitdiff
selinux: fix missing dput() before selinuxfs unmount
authorStephen Smalley <[email protected]>
Mon, 9 Apr 2018 18:36:05 +0000 (14:36 -0400)
committerLinus Torvalds <[email protected]>
Mon, 9 Apr 2018 18:52:56 +0000 (11:52 -0700)
Commit 0619f0f5e36f ("selinux: wrap selinuxfs state") triggers a BUG
when SELinux is runtime-disabled (i.e. systemd or equivalent disables
SELinux before initial policy load via /sys/fs/selinux/disable based on
/etc/selinux/config SELINUX=disabled).

This does not manifest if SELinux is disabled via kernel command line
argument or if SELinux is enabled (permissive or enforcing).

Before:
  SELinux:  Disabled at runtime.
  BUG: Dentry 000000006d77e5c7{i=17,n=null}  still in use (1) [unmount of selinuxfs selinuxfs]

After:
  SELinux:  Disabled at runtime.

Fixes: 0619f0f5e36f ("selinux: wrap selinuxfs state")
Reported-by: Tetsuo Handa <[email protected]>
Reported-by: Dmitry Vyukov <[email protected]>
Signed-off-by: Stephen Smalley <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
security/selinux/selinuxfs.c

index 4be683eeba018d89aa488d156fdaa31d83485750..245160373dabf146ae283e9832dfc89f9535db1c 100644 (file)
@@ -2061,6 +2061,7 @@ __initcall(init_sel_fs);
 void exit_sel_fs(void)
 {
        sysfs_remove_mount_point(fs_kobj, "selinux");
+       dput(selinux_null.dentry);
        kern_unmount(selinuxfs_mount);
        unregister_filesystem(&sel_fs_type);
 }
This page took 0.062416 seconds and 4 git commands to generate.