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: Xiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
This commit is contained in:
Xiu Jianfeng 2022-06-10 17:23:07 +08:00 committed by Casey Schaufler
parent 63c3b5d2ca
commit aa16fb4b9e
1 changed files with 0 additions and 7 deletions

View File

@ -766,13 +766,6 @@ static int smack_set_mnt_opts(struct super_block *sb,
if (sp->smk_flags & SMK_SB_INITIALIZED) if (sp->smk_flags & SMK_SB_INITIALIZED)
return 0; return 0;
if (inode->i_security == NULL) {
int rc = lsm_inode_alloc(inode);
if (rc)
return rc;
}
if (!smack_privileged(CAP_MAC_ADMIN)) { if (!smack_privileged(CAP_MAC_ADMIN)) {
/* /*
* Unprivileged mounts don't get to specify Smack values. * Unprivileged mounts don't get to specify Smack values.