Skip to content

Commit 9c82169

Browse files
robertosassucschaufler
authored andcommitted
smack: Set SMACK64TRANSMUTE only for dirs in smack_inode_setxattr()
Since the SMACK64TRANSMUTE xattr makes sense only for directories, enforce this restriction in smack_inode_setxattr(). 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 6613476 commit 9c82169

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security/smack/smack_lsm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,8 @@ static int smack_inode_setxattr(struct mnt_idmap *idmap,
13141314
check_star = 1;
13151315
} else if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) {
13161316
check_priv = 1;
1317-
if (size != TRANS_TRUE_SIZE ||
1317+
if (!S_ISDIR(d_backing_inode(dentry)->i_mode) ||
1318+
size != TRANS_TRUE_SIZE ||
13181319
strncmp(value, TRANS_TRUE, TRANS_TRUE_SIZE) != 0)
13191320
rc = -EINVAL;
13201321
} else

0 commit comments

Comments
 (0)