]> git.baikalelectronics.ru Git - kernel.git/commitdiff
smack: Remove the redundant lsm_inode_alloc
authorXiu Jianfeng <xiujianfeng@huawei.com>
Fri, 10 Jun 2022 09:23:07 +0000 (17:23 +0800)
committerCasey Schaufler <casey@schaufler-ca.com>
Mon, 1 Aug 2022 18:26:09 +0000 (11:26 -0700)
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>
security/smack/smack_lsm.c

index 6207762dbdb131260730e73dd6456932af84de09..001831458fa2c895283c1b01e4ec77b58047e827 100644 (file)
@@ -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.