summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPassion,Zhao <passion.zhao@intel.com>2013-06-03 11:42:24 +0800
committerHeikki Krogerus <heikki.krogerus@linux.intel.com>2013-11-11 14:15:07 +0200
commitcb212a7ac8d37ae6f97270c6171d88a8ce53e188 (patch)
tree7546f16ff34f1e18de284341159cc71f2c83d664
parent16e9e511732bd71e830a2b631a935fd7e76ba113 (diff)
downloadkernel-mfld-blackbay-cb212a7ac8d37ae6f97270c6171d88a8ce53e188.tar.gz
kernel-mfld-blackbay-cb212a7ac8d37ae6f97270c6171d88a8ce53e188.tar.bz2
kernel-mfld-blackbay-cb212a7ac8d37ae6f97270c6171d88a8ce53e188.zip
Smack: Fix the bug smackcipso can't set CIPSO correctly
Bug report: https://tizendev.org/bugs/browse/TDIS-3891 The reason is userspace libsmack only use "smackfs/cipso2" long-label interface, but the code's logical is still for orginal fixed length label. Now update smack_cipso_apply() to support flexible label (<=256 including tailing '\0') There is also a bug in kernel/security/smack/smackfs.c: When smk_set_cipso() parsing the CIPSO setting from userspace, the offset of CIPSO level should be "strlen(label)+1" instead of "strlen(label)" (Upstream commit id: 0fcfee61d63b82c1eefb5b1a914240480f17d63f) Signed-off-by: Passion,Zhao <passion.zhao@intel.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-rw-r--r--security/smack/smackfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index fa2acd57957..e9563c376ed 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -881,7 +881,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
if (format == SMK_FIXED24_FMT)
rule += SMK_LABELLEN;
else
- rule += strlen(skp->smk_known);
+ rule += strlen(skp->smk_known) + 1;
ret = sscanf(rule, "%d", &maplevel);
if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL)