summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Niesluchowski <m.niesluchow@samsung.com>2014-08-19 14:26:32 +0200
committerDamian Hobson-Garcia <dhobsong@igel.co.jp>2014-12-11 16:53:32 +0900
commit246e0a911ae3217f8fead1fd6e0a7db4f0968adf (patch)
tree39963a8e7dee5ae5e521ef8f5f35cfd3e5da9cb5
parentf92a438b7685a6307b42c353c9f8a622056246b4 (diff)
downloadrenesas_kernel-246e0a911ae3217f8fead1fd6e0a7db4f0968adf.tar.gz
renesas_kernel-246e0a911ae3217f8fead1fd6e0a7db4f0968adf.tar.bz2
renesas_kernel-246e0a911ae3217f8fead1fd6e0a7db4f0968adf.zip
Smack: Fix setting label on successful file open
While opening with CAP_MAC_OVERRIDE file label is not set. Other calls may access it after CAP_MAC_OVERRIDE is dropped from process. Change-Id: I937d070e1c0cb251f4a0dd3291efbc94be3ca548 Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com> Signed-off-by: Rafal Krypa <r.krypa@samsung.com> Origin: git://git.gitorious.org/smack-next/kernel.git# smack-for-3.18 (cherry picked from commit 6047a807302a008d48bd2a4822025b725580c361) Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-rw-r--r--security/smack/smack_lsm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index d347b7911a8..47ed6a48490 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1477,8 +1477,10 @@ static int smack_file_open(struct file *file, const struct cred *cred)
struct smk_audit_info ad;
int rc;
- if (smack_privileged(CAP_MAC_OVERRIDE))
+ if (smack_privileged(CAP_MAC_OVERRIDE)) {
+ file->f_security = isp->smk_inode;
return 0;
+ }
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
smk_ad_setfield_u_fs_path(&ad, file->f_path);