aboutsummaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-08-24 15:59:14 -0400
committerMister Oyster <oysterized@gmail.com>2017-05-24 02:51:47 +0200
commit9e3f95e17c1b30e0e4d3dca0a6631a94f13dd34c (patch)
tree28a0ba95b643475b71a2a51ef24eeb6a8494f140 /security
parentbaafda9652f3f719dd89aaa8ade1ee25bf752d4b (diff)
SELinux: do all flags twiddling in one place
Currently we set the initialize and seclabel flag in one place. Do some unrelated printk then we unset the seclabel flag. Eww. Instead do the flag twiddling in one place in the code not seperated by unrelated printk. Also don't set and unset the seclabel flag. Only set it if we need to. Signed-off-by: Eric Paris <eparis@redhat.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 9b1f54eb4..91ab904c1 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -414,8 +414,6 @@ static int sb_finish_set_opts(struct super_block *sb)
}
}
- sbsec->flags |= (SE_SBINITIALIZED | SE_SBLABELSUPP);
-
if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors))
printk(KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n",
sb->s_id, sb->s_type->name);
@@ -424,11 +422,11 @@ static int sb_finish_set_opts(struct super_block *sb)
sb->s_id, sb->s_type->name,
labeling_behaviors[sbsec->behavior-1]);
- if (sbsec->behavior == SECURITY_FS_USE_GENFS ||
- sbsec->behavior == SECURITY_FS_USE_MNTPOINT ||
- sbsec->behavior == SECURITY_FS_USE_NONE ||
- sbsec->behavior > ARRAY_SIZE(labeling_behaviors))
- sbsec->flags &= ~SE_SBLABELSUPP;
+ sbsec->flags |= SE_SBINITIALIZED;
+ if (sbsec->behavior == SECURITY_FS_USE_XATTR ||
+ sbsec->behavior == SECURITY_FS_USE_TRANS ||
+ sbsec->behavior == SECURITY_FS_USE_TASK)
+ sbsec->flags |= SE_SBLABELSUPP;
/* Special handling. Is genfs but also has in-core setxattr handler*/
if (!strcmp(sb->s_type->name, "sysfs") ||