Smack: change rule cap check
authorCasey Schaufler <casey@schaufler-ca.com>
Thu, 19 Dec 2013 21:23:26 +0000 (13:23 -0800)
committerChanho Park <parkch98@gmail.com>
Fri, 23 Jan 2015 14:27:04 +0000 (23:27 +0900)
smk_write_change_rule() is calling capable rather than
the more correct smack_privileged(). This allows for setting
rules in violation of the onlycap facility. This is the
simple repair.

Change-Id: Icb5321b5b5355d64b0b029d9131cf60b5e97d356
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Ɓukasz Stelmach <l.stelmach@samsung.com>
security/smack/smackfs.c

index bd5c6e197504ffc38ba8c3810c1d33b7211748c3..6d8b8e73b15efbc38c3cc6737bd6945b986f85a9 100644 (file)
@@ -2151,7 +2151,7 @@ static ssize_t smk_write_change_rule(struct file *file, const char __user *buf,
        /*
         * Must have privilege.
         */
-       if (!capable(CAP_MAC_ADMIN))
+       if (!smack_privileged(CAP_MAC_ADMIN))
                return -EPERM;
 
        return smk_write_rules_list(file, buf, count, ppos, NULL, NULL,