BACKPORT: Smack: Fix the bug smackcipso can't set CIPSO correctly
authorPassion,Zhao <passion.zhao@intel.com>
Mon, 3 Jun 2013 03:42:24 +0000 (11:42 +0800)
committerRafal Krypa <r.krypa@samsung.com>
Thu, 30 Jun 2016 12:57:26 +0000 (14:57 +0200)
commit7ff6223b91bc5a90f189bbd95bd2f1f19e908328
tree2bef3a1abf2012ceffb5eb0ae6a989538f8c59d4
parent36818b6de7df4ac963b1ac9f6dc171d2ca55cb45
BACKPORT: 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)"

Signed-off-by: Passion,Zhao <passion.zhao@intel.com>
(cherry-picked from upstream 0fcfee61d63b82c1eefb5b1a914240480f17d63f)
security/smack/smackfs.c