Commit 9c821692 authored by Roberto Sassu's avatar Roberto Sassu Committed by Casey Schaufler
Browse files

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: stable@vger.kernel.org
Fixes: 5c6d1125 ("Smack: Transmute labels on specified directories") # v2.6.38.x
Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
parent 6613476e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1314,7 +1314,8 @@ static int smack_inode_setxattr(struct mnt_idmap *idmap,
		check_star = 1;
	} else if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) {
		check_priv = 1;
		if (size != TRANS_TRUE_SIZE ||
		if (!S_ISDIR(d_backing_inode(dentry)->i_mode) ||
		    size != TRANS_TRUE_SIZE ||
		    strncmp(value, TRANS_TRUE, TRANS_TRUE_SIZE) != 0)
			rc = -EINVAL;
	} else