Skip to content

Commit ac02f00

Browse files
robertosassucschaufler
authored andcommitted
smack: Handle SMACK64TRANSMUTE in smack_inode_setsecurity()
If the SMACK64TRANSMUTE xattr is provided, and the inode is a directory, update the in-memory inode flags by setting SMK_INODE_TRANSMUTE. Cc: [email protected] Fixes: 5c6d112 ("Smack: Transmute labels on specified directories") # v2.6.38.x Signed-off-by: Roberto Sassu <[email protected]> Signed-off-by: Casey Schaufler <[email protected]>
1 parent 9c82169 commit ac02f00

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

security/smack/smack_lsm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,6 +2856,15 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
28562856
if (value == NULL || size > SMK_LONGLABEL || size == 0)
28572857
return -EINVAL;
28582858

2859+
if (strcmp(name, XATTR_SMACK_TRANSMUTE) == 0) {
2860+
if (!S_ISDIR(inode->i_mode) || size != TRANS_TRUE_SIZE ||
2861+
strncmp(value, TRANS_TRUE, TRANS_TRUE_SIZE) != 0)
2862+
return -EINVAL;
2863+
2864+
nsp->smk_flags |= SMK_INODE_TRANSMUTE;
2865+
return 0;
2866+
}
2867+
28592868
skp = smk_import_entry(value, size);
28602869
if (IS_ERR(skp))
28612870
return PTR_ERR(skp);

0 commit comments

Comments
 (0)