Commit aa16fb4b authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Casey Schaufler
Browse files

smack: Remove the redundant lsm_inode_alloc



It's not possible for inode->i_security to be NULL here because every
inode will call inode_init_always and then lsm_inode_alloc to alloc
memory for inode->security, this is what LSM infrastructure management
do, so remove this redundant code.

Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
parent 63c3b5d2
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -766,13 +766,6 @@ static int smack_set_mnt_opts(struct super_block *sb,
	if (sp->smk_flags & SMK_SB_INITIALIZED)
		return 0;

	if (inode->i_security == NULL) {
		int rc = lsm_inode_alloc(inode);

		if (rc)
			return rc;
	}

	if (!smack_privileged(CAP_MAC_ADMIN)) {
		/*
		 * Unprivileged mounts don't get to specify Smack values.