diff options
author | Marcin Niesluchowski <m.niesluchow@samsung.com> | 2014-08-19 14:26:32 +0200 |
---|---|---|
committer | Casey Schaufler <casey@schaufler-ca.com> | 2014-08-25 14:27:28 -0700 |
commit | d83d2c26461d661384676a4eed935d925b0fcc34 (patch) | |
tree | 7f37947642d81d58f7a48e8ea9473a1894257c36 /security/smack/smack_lsm.c | |
parent | da1b63566c469bf3e2b24182114422e16b1aa34c (diff) |
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.
Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com>
Diffstat (limited to 'security/smack/smack_lsm.c')
-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 16ae8534b14c..7091b46adab2 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); |