summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Niesluchowski <m.niesluchow@samsung.com>2014-08-19 14:26:32 +0200
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>2015-02-04 11:23:25 +0100
commit2948accb198e6b7263a8d1dab9458ee152e15c81 (patch)
tree18079bb3857c4089b65f70e80adf9bbb284d5958
parent76cd3ed66c52833c12f8cab52a490b8f0cd0d5e3 (diff)
downloadkernel-common-2948accb198e6b7263a8d1dab9458ee152e15c81.tar.gz
kernel-common-2948accb198e6b7263a8d1dab9458ee152e15c81.tar.bz2
kernel-common-2948accb198e6b7263a8d1dab9458ee152e15c81.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
-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 d347b7911a83..47ed6a484901 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);