* [PATCH -next] smack: Remove the redundant lsm_inode_alloc
@ 2022-06-10 9:23 Xiu Jianfeng
2022-06-10 20:11 ` Casey Schaufler
0 siblings, 1 reply; 2+ messages in thread
From: Xiu Jianfeng @ 2022-06-10 9:23 UTC (permalink / raw)
To: casey, jmorris, serge; +Cc: linux-security-module, linux-kernel
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>
---
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.
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH -next] smack: Remove the redundant lsm_inode_alloc
2022-06-10 9:23 [PATCH -next] smack: Remove the redundant lsm_inode_alloc Xiu Jianfeng
@ 2022-06-10 20:11 ` Casey Schaufler
0 siblings, 0 replies; 2+ messages in thread
From: Casey Schaufler @ 2022-06-10 20:11 UTC (permalink / raw)
To: Xiu Jianfeng, jmorris, serge
Cc: linux-security-module, linux-kernel, Casey Schaufler
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-10 20:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 9:23 [PATCH -next] smack: Remove the redundant lsm_inode_alloc Xiu Jianfeng
2022-06-10 20:11 ` Casey Schaufler
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®