diff options
author | Casey Schaufler <casey@schaufler-ca.com> | 2014-04-10 16:35:36 -0700 |
---|---|---|
committer | Damian Hobson-Garcia <dhobsong@igel.co.jp> | 2014-12-11 16:53:28 +0900 |
commit | 774d0fc013a844dfc858b34fe328f32c4f0d81f3 (patch) | |
tree | cdc472ff050bca25c1e1bff56d29f57787ed5dd4 | |
parent | 32ebb8d753dc61769dd476f8255e8ff976f62274 (diff) | |
download | renesas_kernel-774d0fc013a844dfc858b34fe328f32c4f0d81f3.tar.gz renesas_kernel-774d0fc013a844dfc858b34fe328f32c4f0d81f3.tar.bz2 renesas_kernel-774d0fc013a844dfc858b34fe328f32c4f0d81f3.zip |
Smack: Correctly remove SMACK64TRANSMUTE attribute
Sam Henderson points out that removing the SMACK64TRANSMUTE
attribute from a directory does not result in the directory
transmuting. This is because the inode flag indicating that
the directory is transmuting isn't cleared. The fix is a tad
less than trivial because smk_task and smk_mmap should have
been broken out, too.
Targeted for git://git.gitorious.org/smack-next/kernel.git
Change-Id: Iae25080bfd0ec247391c997a59f3e2327423e33d
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry picked from commit 965242f323fcfa32182059100c0f43db07767bfa)
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-rw-r--r-- | security/smack/smack_lsm.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index b86825b722d..1c05130f17e 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1026,18 +1026,31 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) } else rc = cap_inode_removexattr(dentry, name); + if (rc != 0) + return rc; + smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); smk_ad_setfield_u_fs_path_dentry(&ad, dentry); - if (rc == 0) - rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); - if (rc == 0) { - isp = dentry->d_inode->i_security; + rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); + if (rc != 0) + return rc; + + isp = dentry->d_inode->i_security; + /* + * Don't do anything special for these. + * XATTR_NAME_SMACKIPIN + * XATTR_NAME_SMACKIPOUT + * XATTR_NAME_SMACKEXEC + */ + if (strcmp(name, XATTR_NAME_SMACK) == 0) isp->smk_task = NULL; + else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0) isp->smk_mmap = NULL; - } + else if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) + isp->smk_flags &= ~SMK_INODE_TRANSMUTE; - return rc; + return 0; } /** |