mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Xiu Jianfeng <xiujianfeng@huawei.com>,
	jmorris@namei.org, serge@hallyn.com
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH -next] smack: Remove the redundant lsm_inode_alloc
Date: Fri, 10 Jun 2022 13:11:36 -0700	[thread overview]
Message-ID: <f98c7555-50ba-d505-b3bf-c3c8c5b2d290@schaufler-ca.com> (raw)
In-Reply-To: <20220610092307.30311-1-xiujianfeng@huawei.com>

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@huawei.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.

      reply	other threads:[~2022-06-10 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  9:23 Xiu Jianfeng
2022-06-10 20:11 ` Casey Schaufler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f98c7555-50ba-d505-b3bf-c3c8c5b2d290@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=xiujianfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®