From: Austin Kim <austindh.kim@gmail.com>
To: paul@paul-moore.com, stephen.smalley.work@gmail.com,
eparis@parisplace.org
Cc: selinux@vger.kernel.org, linux-kernel@vger.kernel.org,
austin.kim@lge.com, kernel-team@lge.com
Subject: [PATCH] selinux: remove duplicated LABEL_INITIALIZED check routine
Date: Wed, 2 Jun 2021 06:48:02 +0100 [thread overview]
Message-ID: <20210602054802.GA984@raspberrypi> (raw)
The 'isec->initialized == LABEL_INITIALIZED' is checked twice in a row,
since selinux was mainlined from Linux-2.6.12-rc2.
Since 'isec->initialized' is protected using spin_lock(&isec->lock)
within various APIs, it had better remove first exceptional routine.
With this commit, the code look simpler, easier to read and maintain.
Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
security/selinux/hooks.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index fc6a3ab7e179..a236b0a33665 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1448,9 +1448,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
struct dentry *dentry;
int rc = 0;
- if (isec->initialized == LABEL_INITIALIZED)
- return 0;
-
spin_lock(&isec->lock);
if (isec->initialized == LABEL_INITIALIZED)
goto out_unlock;
--
2.20.1
next reply other threads:[~2021-06-02 5:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 5:48 Austin Kim [this message]
2021-06-02 14:32 ` [PATCH] selinux: remove duplicated LABEL_INITIALIZED check routine Paul Moore
2021-06-02 23:41 ` Austin Kim
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=20210602054802.GA984@raspberrypi \
--to=austindh.kim@gmail.com \
--cc=austin.kim@lge.com \
--cc=eparis@parisplace.org \
--cc=kernel-team@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.