From: Pankaj Kumar Date: Fri, 13 Dec 2013 09:42:22 +0000 (+0530) Subject: bugfix patch for SMACK X-Git-Tag: submit/tizen_common/20140905.094502~14^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7bb3b3b3daaffd0ea2bc84f95a0b692baf63f3a9;p=sdk%2Femulator%2Femulator-kernel.git bugfix patch for SMACK 1. In order to remove any SMACK extended attribute from a file, a user should have CAP_MAC_ADMIN capability. But user without having this capability is able to remove SMACK64MMAP security attribute. 2. While validating size and value of smack extended attribute in smack_inode_setsecurity hook, wrong error code is returned. Change-Id: Ie71e86840f47b6810aaf4ff9a577cdea8274925b Signed-off-by: Pankaj Kumar Signed-off-by: Himanshu Shukla --- diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index efd19502582b..3b4c17265a22 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1018,7 +1018,7 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) strcmp(name, XATTR_NAME_SMACKIPOUT) == 0 || strcmp(name, XATTR_NAME_SMACKEXEC) == 0 || strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0 || - strcmp(name, XATTR_NAME_SMACKMMAP)) { + strcmp(name, XATTR_NAME_SMACKMMAP) == 0) { if (!smack_privileged(CAP_MAC_ADMIN)) rc = -EPERM; } else @@ -2156,7 +2156,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, int rc = 0; if (value == NULL || size > SMK_LONGLABEL || size == 0) - return -EACCES; + return -EINVAL; skp = smk_import_entry(value, size); if (skp == NULL)