Skip to content

Commit fd40ffc

Browse files
stephensmalleytorvalds
authored andcommitted
selinux: fix missing dput() before selinuxfs unmount
Commit 0619f0f ("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: 0619f0f ("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]>
1 parent d8312a3 commit fd40ffc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

security/selinux/selinuxfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,7 @@ __initcall(init_sel_fs);
20612061
void exit_sel_fs(void)
20622062
{
20632063
sysfs_remove_mount_point(fs_kobj, "selinux");
2064+
dput(selinux_null.dentry);
20642065
kern_unmount(selinuxfs_mount);
20652066
unregister_filesystem(&sel_fs_type);
20662067
}

0 commit comments

Comments
 (0)