[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f98c7555-50ba-d505-b3bf-c3c8c5b2d290@schaufler-ca.com>
Date: Fri, 10 Jun 2022 13:11:36 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: Xiu Jianfeng <xiujianfeng@...wei.com>, jmorris@...ei.org,
serge@...lyn.com
Cc: linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org,
Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [PATCH -next] smack: Remove the redundant lsm_inode_alloc
On 6/10/2022 2:23 AM, Xiu Jianfeng wrote:
> 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@...wei.com>
I've taken this for smack-next. Thank you.
> ---
> security/smack/smack_lsm.c | 7 -------
> 1 file changed, 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.
Powered by blists - more mailing lists