Skip to contentSkip to conversation

Bug fix for selinux_inode_delete hook

PATCH New Stephen Smalley 1 participant 1 message Nov 20, 2001 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bug fix for selinux_inode_delete hook

The attached patch fixes a bug in the selinux_inode_delete hook function in the latest release. Sorry for not catching this prior to the release. This hook function should only call clear_psid if the inode is associated with a superblock that uses persistent SIDs. This is particularly a problem if the inode does not have an associated superblock at all. You can apply this patch by saving it to ~/delete.patch, changing to the selinux directory, and running 'patch -p1 < ~/delete.patch'. This patch is for the hooks.c file, which is located in selinux/module/selinux_plug in the SELinux archive or in lsm/security/selinux when SELinux is inserted into the kernel tree.

--
Stephen D. Smalley, NAI Labs
[email protected]

Index: selinux/module/selinux_plug/hooks.c

module/selinux_plug/hooks.c renamed from module/selinux_plug/hooks.c:1.69 +6 -1
diff -u selinux/module/selinux_plug/hooks.c:1.69 selinux/module/selinux_plug/hooks.c:1.70
@@ -2159,7 +2159,12 @@
 
 static void selinux_inode_delete(struct inode *inode)
 {
-	clear_psid(inode);
+	struct super_block *sb = inode->i_sb; 
+	if (sb) {
+		struct superblock_security_struct *sbsec = sb->s_security;
+		if (sbsec && sbsec->uses_psids)
+			clear_psid(inode);
+	}
 }