Skip to contentSkip to conversation

selinux: fix sel_kill_sb()

PATCH Applied Stephen Smalley 2 participants 2 messages Apr 29 SELinux security module

lore
Share & tools
lore

Stephen Smalley

author maintainer
#0 lore raw

PATCH 1/1 selinux: fix sel_kill_sb()

Fix the order in sel_kill_sb() to match other pseudo filesystems. This does not currently matter for selinuxfs per se but could in the future, e.g. with SELinux namespaces and multiple selinuxfs instances.

---
 security/selinux/selinuxfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
security/selinux/selinuxfs.c +5 -5
index 8c107af5140e..c4a68d623d40 100644
@@ -95,9 +95,8 @@ static int selinux_fs_info_create(struct super_block *sb)
 	return 0;
 }
 
-static void selinux_fs_info_free(struct super_block *sb)
+static void selinux_fs_info_free(struct selinux_fs_info *fsi)
 {
-	struct selinux_fs_info *fsi = sb->s_fs_info;
 	unsigned int i;
 
 	if (fsi) {
@@ -106,8 +105,7 @@ static void selinux_fs_info_free(struct super_block *sb)
 		kfree(fsi->bool_pending_names);
 		kfree(fsi->bool_pending_values);
 	}
-	kfree(sb->s_fs_info);
-	sb->s_fs_info = NULL;
+	kfree(fsi);
 }
 
 #define SEL_INITCON_INO_OFFSET		0x01000000
@@ -2093,8 +2091,10 @@ static int sel_init_fs_context(struct fs_context *fc)
 
 static void sel_kill_sb(struct super_block *sb)
 {
-	selinux_fs_info_free(sb);
+	struct selinux_fs_info *fsi = sb->s_fs_info;
+
 	kill_anon_super(sb);
+	selinux_fs_info_free(fsi);
 }
 
 static struct file_system_type sel_fs_type = {
Signature · 1 line
2.54.0
maintainer Applied
#1 lore raw
Quoted 10 lines · On Apr 29, 2026 Stephen Smalley <[email protected]> wrote:

Fix the order in sel_kill_sb() to match other pseudo filesystems. This does not currently matter for selinuxfs per se but could in the future, e.g. with SELinux namespaces and multiple selinuxfs instances.

---
 security/selinux/selinuxfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Merged into selinux/dev, thanks.

--
paul-moore.com