diff options
author | Passion,Zhao <passion.zhao@intel.com> | 2013-06-03 11:42:24 +0800 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:46:05 +0900 |
commit | 0c541642864e285f8d27fbffa4720323ff33ec96 (patch) | |
tree | 93b448b45767f55e75342dcf20fcf5f35021ad37 /security | |
parent | 7b8ae9d19bd8c31ee4e99c0e268a7019d189426b (diff) | |
download | linux-3.10-0c541642864e285f8d27fbffa4720323ff33ec96.tar.gz linux-3.10-0c541642864e285f8d27fbffa4720323ff33ec96.tar.bz2 linux-3.10-0c541642864e285f8d27fbffa4720323ff33ec96.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)"
Change-Id: I7be85b4ade557e25569970e61c9e09ca01b5f2d9
Signed-off-by: Passion,Zhao <passion.zhao@intel.com>
Signed-off-by: Ćukasz Stelmach <l.stelmach@samsung.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/smack/smackfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 3c79cba5fa4..ab167037b2d 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) |