aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack
diff options
context:
space:
mode:
authorXiu Jianfeng <xiujianfeng@huawei.com>2022-06-10 17:23:07 +0800
committerCasey Schaufler <casey@schaufler-ca.com>2022-08-01 11:26:09 -0700
commitaa16fb4b9e7e1057008d999138e7ae68a40bf167 (patch)
tree00c0321d28adb5c7145477378959554882ab89d2 /security/smack
parentsmack: Replace kzalloc + strncpy with kstrndup (diff)
downloadlinux-dev-aa16fb4b9e7e1057008d999138e7ae68a40bf167.tar.xz
linux-dev-aa16fb4b9e7e1057008d999138e7ae68a40bf167.zip
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>
Diffstat (limited to 'security/smack')
-rw-r--r--security/smack/smack_lsm.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 6207762dbdb1..001831458fa2 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -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.