aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-01-09 07:32:47 -0800
committerMohammed Habibulla <moch@google.com>2015-12-21 12:15:06 -0800
commit101cccb03c4a70a328a74366c88bc6ccaafef931 (patch)
tree2148325305e90cebbc64cfef958a6d046559d960
parenta31dd35ce98494a3cbb23eaba3ac3a8671d5dc7e (diff)
downloadpxa-v3.14-101cccb03c4a70a328a74366c88bc6ccaafef931.tar.gz
Merge selinux fix to support in-core xattr of debufgs
Cherry pick from https://android-review.googlesource.com/#/c/123424/1 pstore: selinux: add security in-core xattr support for pstore and debugfs - add "pstore" and "debugfs" to list of in-core exceptions - change fstype checks to boolean equation - change from strncmp to strcmp for checking Signed-off-by: Mark Salyzyn <salyzyn@android.com> BUG=26258202 Change-Id: I35b41660701fe63a5e8173813ac62b84474ec48f
-rw-r--r--security/selinux/hooks.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index d974ebb2716..3feec1f377d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -392,23 +392,14 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)
{
struct superblock_security_struct *sbsec = sb->s_security;
- if (sbsec->behavior == SECURITY_FS_USE_XATTR ||
- sbsec->behavior == SECURITY_FS_USE_TRANS ||
- sbsec->behavior == SECURITY_FS_USE_TASK)
- return 1;
-
- /* Special handling for sysfs. Is genfs but also has setxattr handler*/
- if (strncmp(sb->s_type->name, "sysfs", sizeof("sysfs")) == 0)
- return 1;
-
- /*
- * Special handling for rootfs. Is genfs but supports
- * setting SELinux context on in-core inodes.
- */
- if (strncmp(sb->s_type->name, "rootfs", sizeof("rootfs")) == 0)
- return 1;
-
- return 0;
+ return sbsec->behavior == SECURITY_FS_USE_XATTR ||
+ sbsec->behavior == SECURITY_FS_USE_TRANS ||
+ sbsec->behavior == SECURITY_FS_USE_TASK ||
+ /* Special handling. Genfs but also in-core setxattr handler */
+ !strcmp(sb->s_type->name, "sysfs") ||
+ !strcmp(sb->s_type->name, "pstore") ||
+ !strcmp(sb->s_type->name, "debugfs") ||
+ !strcmp(sb->s_type->name, "rootfs");
}
static int sb_finish_set_opts(struct super_block *sb)