All of lore.kernel.org
 help / color / mirror / Atom feed
From: GUO Zihua <guozihua@huawei.com>
To: <zohar@linux.ibm.com>, <paul@paul-moore.com>
Cc: <linux-security-module@vger.kernel.org>,
	<linux-rdma@vger.kernel.org>, <dledford@redhat.com>,
	<jgg@ziepe.ca>
Subject: [PATCH 4.19 v2 4/5] ima: Evaluate error in init_ima()
Date: Thu, 16 Feb 2023 20:42:26 +0800	[thread overview]
Message-ID: <20230216124227.44058-5-guozihua@huawei.com> (raw)
In-Reply-To: <20230216124227.44058-1-guozihua@huawei.com>

From: Roberto Sassu <roberto.sassu@huawei.com>

[ Upstream commit e144d6b265415ddbdc54b3f17f4f95133effa5a8 ]

Evaluate error in init_ima() before register_blocking_lsm_notifier() and
return if not zero.

Cc: stable@vger.kernel.org # 5.3.x
Fixes: b16942455193 ("ima: use the lsm policy update notifier")
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: James Morris <jamorris@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: GUO Zihua <guozihua@huawei.com>
---
 security/integrity/ima/ima_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 55681872c6ce..fcaaf2c2ba4b 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -557,6 +557,9 @@ static int __init init_ima(void)
 		error = ima_init();
 	}
 
+	if (error)
+		return error;
+
 	error = register_blocking_lsm_notifier(&ima_lsm_policy_notifier);
 	if (error)
 		pr_warn("Couldn't register LSM notifier, error %d\n", error);
-- 
2.17.1


  parent reply	other threads:[~2023-02-16 12:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 12:42 [PATCH 4.19 v2 0/5] Backport handling -ESTALE policy update failure to 4.19 GUO Zihua
2023-02-16 12:42 ` [PATCH 4.19 v2 1/5] IB/core: Don't register each MAD agent for LSM notifier GUO Zihua
2023-02-16 12:42 ` [PATCH 4.19 v2 2/5] LSM: switch to blocking policy update notifiers GUO Zihua
2023-02-16 12:42 ` [PATCH 4.19 v2 3/5] ima: use the lsm policy update notifier GUO Zihua
2023-02-16 12:42 ` GUO Zihua [this message]
2023-02-16 12:42 ` [PATCH 4.19 v2 5/5] ima: Handle -ESTALE returned by ima_filter_rule_match() GUO Zihua
2023-02-22 15:24 ` [PATCH 4.19 v2 0/5] Backport handling -ESTALE policy update failure to 4.19 Mimi Zohar
2023-02-23  1:31   ` Guozihua (Scott)

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=20230216124227.44058-5-guozihua@huawei.com \
    --to=guozihua@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=zohar@linux.ibm.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.