Skip to contentSkip to conversation

selinux: simply inode label states to INVALID and INITIALIZED

PATCH New Paul Moore 1 participant 1 message Mar 28, 2016 SELinux security module

lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 selinux: simply inode label states to INVALID and INITIALIZED

From: Paul Moore <[email protected]>

There really is no need for LABEL_MISSING as we really only care if the inode's label is INVALID or INITIALIZED. Also adjust the revalidate code to reload the label whenever the label is not INITIALIZED so we are less sensitive to label state in the future.

---
 security/selinux/hooks.c          |    2 +-
 security/selinux/include/objsec.h |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
security/selinux/hooks.c +1 -1
index ec1a1a8..837c566 100644
@@ -259,7 +259,7 @@ static int __inode_security_revalidate(struct inode *inode,
 
 	might_sleep_if(may_sleep);
 
-	if (isec->initialized == LABEL_INVALID) {
+	if (isec->initialized != LABEL_INITIALIZED) {
 		if (!may_sleep)
 			return -ECHILD;
 
security/selinux/include/objsec.h +2 -3
index a2ae054..c21e135 100644
@@ -38,9 +38,8 @@ struct task_security_struct {
 };
 
 enum label_initialized {
-	LABEL_MISSING,		/* not initialized */
-	LABEL_INITIALIZED,	/* inizialized */
-	LABEL_INVALID		/* invalid */
+	LABEL_INVALID,		/* invalid or not initialized */
+	LABEL_INITIALIZED	/* initialized */
 };
 
 struct inode_security_struct {