aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/smack/smackfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 54f6e18dea2f..5498c4a2d1ae 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -1497,6 +1497,7 @@ static ssize_t smk_write_access(struct file *file, const char __user *buf,
1497{ 1497{
1498 struct smack_rule rule; 1498 struct smack_rule rule;
1499 char *data; 1499 char *data;
1500 int res;
1500 1501
1501 if (!capable(CAP_MAC_ADMIN)) 1502 if (!capable(CAP_MAC_ADMIN))
1502 return -EPERM; 1503 return -EPERM;
@@ -1508,8 +1509,10 @@ static ssize_t smk_write_access(struct file *file, const char __user *buf,
1508 if (count < SMK_LOADLEN || smk_parse_rule(data, &rule)) 1509 if (count < SMK_LOADLEN || smk_parse_rule(data, &rule))
1509 return -EINVAL; 1510 return -EINVAL;
1510 1511
1511 data[0] = smk_access(rule.smk_subject, rule.smk_object, 1512 res = smk_access(rule.smk_subject, rule.smk_object, rule.smk_access,
1512 rule.smk_access, NULL) == 0; 1513 NULL);
1514 data[0] = res == 0 ? '1' : '0';
1515 data[1] = '\0';
1513 1516
1514 simple_transaction_set(file, 1); 1517 simple_transaction_set(file, 1);
1515 return SMK_LOADLEN; 1518 return SMK_LOADLEN;