diff options
author | Marcin Niesluchowski <m.niesluchow@samsung.com> | 2014-08-19 14:26:32 +0200 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@open.eurogiciel.org> | 2015-02-04 11:23:25 +0100 |
commit | 2948accb198e6b7263a8d1dab9458ee152e15c81 (patch) | |
tree | 18079bb3857c4089b65f70e80adf9bbb284d5958 /security | |
parent | 76cd3ed66c52833c12f8cab52a490b8f0cd0d5e3 (diff) | |
download | linux-stable-2948accb198e6b7263a8d1dab9458ee152e15c81.tar.gz linux-stable-2948accb198e6b7263a8d1dab9458ee152e15c81.tar.bz2 linux-stable-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
Diffstat (limited to 'security')
-rw-r--r-- | security/smack/smack_lsm.c | 4 |
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); |