Re: [PATCH] selinux: clean up selinuxfs resources on init failure
From: Paul Moore
Date: Wed Jul 01 2026 - 17:23:47 EST
On Jun 22, 2026 Haoxiang Li <haoxiang_li2024@xxxxxxx> wrote:
>
> init_sel_fs() creates the selinuxfs mount point and registers the
> filesystem before mounting selinuxfs internally. If kern_mount()
> or the subsequent lookup of the null file fails, the function
> returns without undoing the resources that were already registered.
>
> Add the missing error unwinding so the internal mount, filesystem
> registration, and sysfs mount point are released as appropriate.
>
> Signed-off-by: Haoxiang Li <haoxiang_li2024@xxxxxxx>
> Acked-by: Stephen Smalley <stephen.smalley.work@xxxxxxxxx>
> ---
> security/selinux/selinuxfs.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
As Stephen already pointed out, the cleanup isn't critical as the system
is going to fall over any die anyway, but it shouldn't hurt. Merged into
selinux/dev.
--
paul-moore.com