[PATCH 3/4] selinuxfs: free sb->s_fs_info after shutting down the super block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sb->s_fs_info can only be safely freed after generic_shutdown_super was
called and all access to the super_block has stopped.

Thus only free the private data after calling kill_litter_super, which
calls generic_shutdown_super internally.

Also remove the duplicate freeing in the sel_fill_super error path given
that ->kіll_sb is also called on ->fill_super failure.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 security/selinux/selinuxfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 9dafb6ff110d26..8a8a532be8e767 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -2100,9 +2100,6 @@ static int sel_fill_super(struct super_block *sb, struct fs_context *fc)
 err:
 	pr_err("SELinux: %s:  failed while creating inodes\n",
 		__func__);
-
-	selinux_fs_info_free(sb);
-
 	return ret;
 }
 
@@ -2123,8 +2120,8 @@ static int sel_init_fs_context(struct fs_context *fc)
 
 static void sel_kill_sb(struct super_block *sb)
 {
-	selinux_fs_info_free(sb);
 	kill_litter_super(sb);
+	selinux_fs_info_free(sb);
 }
 
 static struct file_system_type sel_fs_type = {
-- 
2.39.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux