Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Denis Semakin <denis.semakin@huawei.com>
To: <linux-integrity@vger.kernel.org>
Cc: <artem.kuzin@huawei.com>, <konstantin.meskhidze@huawei.com>,
	<yusongping@huawei.com>, <hukeping@huawei.com>,
	<roberto.sassu@huawei.com>, <krzysztof.struczynski@huawei.com>,
	<stefanb@linux.ibm.com>, <denis.semakin@huawei-partners.com>,
	<ilya.hanov@huawei-partners.com>
Subject: [PATCH v1 1/1] ima: fix possible memory leak in cache allocating for namespace
Date: Sat, 24 Dec 2022 14:59:46 +0800	[thread overview]
Message-ID: <20221224065946.349471-1-denis.semakin@huawei.com> (raw)
In-Reply-To: <20220915193221.1728029-1-stefanb@linux.ibm.com>

Signed-off-by: Denis Semakin <denis.semakin@huawei.com>
Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
---
 security/integrity/ima/ima_init_ima_ns.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/security/integrity/ima/ima_init_ima_ns.c b/security/integrity/ima/ima_init_ima_ns.c
index 1eaa6ceee2ee..5c850b740ae6 100644
--- a/security/integrity/ima/ima_init_ima_ns.c
+++ b/security/integrity/ima/ima_init_ima_ns.c
@@ -43,12 +43,16 @@ int ima_init_namespace(struct ima_namespace *ns)
 		ret = register_blocking_lsm_notifier
 						(&ns->ima_lsm_policy_notifier);
 		if (ret)
-			return ret;
+			goto destroy_cache;
 	}
 
 	set_bit(IMA_NS_ACTIVE, &ns->ima_ns_flags);
 
 	return 0;
+
+destroy_cache:
+	kmem_cache_destroy(ns->ns_status_cache);
+	return ret;
 }
 
 int __init ima_ns_init(void)
-- 
2.38.GIT


      parent reply	other threads:[~2022-12-24  7:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 19:31 [PATCH v14 00/26] ima: Namespace IMA with audit support in IMA-ns Stefan Berger
2022-09-15 19:31 ` [PATCH v14 01/26] securityfs: rework dentry creation Stefan Berger
2022-09-15 19:31 ` [PATCH v14 02/26] securityfs: Extend securityfs with namespacing support Stefan Berger
2022-09-15 19:31 ` [PATCH v14 03/26] ima: Define ima_namespace struct and start moving variables into it Stefan Berger
2022-09-15 19:31 ` [PATCH v14 04/26] ima: Move arch_policy_entry into ima_namespace Stefan Berger
2022-09-15 19:32 ` [PATCH v14 05/26] ima: Move ima_htable " Stefan Berger
2022-09-15 19:32 ` [PATCH v14 06/26] ima: Move measurement list related variables " Stefan Berger
2022-09-15 19:32 ` [PATCH v14 07/26] ima: Move some IMA policy and filesystem " Stefan Berger
2022-09-15 19:32 ` [PATCH v14 08/26] ima: Move IMA securityfs files into ima_namespace or onto stack Stefan Berger
2022-09-15 19:32 ` [PATCH v14 09/26] ima: Move ima_lsm_policy_notifier into ima_namespace Stefan Berger
2022-09-15 19:32 ` [PATCH v14 10/26] ima: Switch to lazy lsm policy updates for better performance Stefan Berger
2022-09-15 19:32 ` [PATCH v14 11/26] ima: Define mac_admin_ns_capable() as a wrapper for ns_capable() Stefan Berger
2022-09-15 19:32 ` [PATCH v14 12/26] ima: Only accept AUDIT rules for non-init_ima_ns namespaces for now Stefan Berger
2022-09-15 19:32 ` [PATCH v14 13/26] userns: Add pointer to ima_namespace to user_namespace Stefan Berger
2022-09-15 19:32 ` [PATCH v14 14/26] ima: Implement hierarchical processing of file accesses Stefan Berger
2022-09-15 19:32 ` [PATCH v14 15/26] ima: Implement ima_free_policy_rules() for freeing of an ima_namespace Stefan Berger
2022-09-15 19:32 ` [PATCH v14 16/26] ima: Add functions for creating and " Stefan Berger
2022-09-15 19:32 ` [PATCH v14 17/26] integrity/ima: Define ns_status for storing namespaced iint data Stefan Berger
2022-12-24  7:05   ` [PATCH v1 1/1] ima: fix possible memory leak in cache allocating for namespace Denis Semakin
2022-12-26  2:43     ` [RFC PATCH v2] " Denis Semakin
2022-12-28 16:35       ` Stefan Berger
2022-09-15 19:32 ` [PATCH v14 18/26] integrity: Add optional callback function to integrity_inode_free() Stefan Berger
2022-09-15 19:32 ` [PATCH v14 19/26] ima: Namespace audit status flags Stefan Berger
2022-09-15 19:32 ` [PATCH v14 20/26] ima: Remove unused iints from the integrity_iint_cache Stefan Berger
2022-09-15 19:32 ` [PATCH v14 21/26] ima: Setup securityfs for IMA namespace Stefan Berger
2022-09-15 19:32 ` [PATCH v14 22/26] ima: Introduce securityfs file to activate an " Stefan Berger
2022-09-15 19:32 ` [PATCH v14 23/26] ima: Show owning user namespace's uid and gid when displaying policy Stefan Berger
2022-09-15 19:32 ` [PATCH v14 24/26] ima: Limit number of policy rules in non-init_ima_ns Stefan Berger
2022-09-15 19:32 ` [PATCH v14 25/26] ima: Restrict informational audit messages to init_ima_ns Stefan Berger
2022-09-15 19:32 ` [PATCH v14 26/26] ima: Enable IMA namespaces Stefan Berger
2022-09-16  0:56 ` [PATCH v14 00/26] ima: Namespace IMA with audit support in IMA-ns Casey Schaufler
2022-09-16 10:54   ` Stefan Berger
2022-09-16 13:20     ` Stefan Berger
2022-09-16 17:05     ` Casey Schaufler
2022-09-20 20:08 ` Stefan Berger
2022-12-24  6:59 ` Denis Semakin [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=20221224065946.349471-1-denis.semakin@huawei.com \
    --to=denis.semakin@huawei.com \
    --cc=artem.kuzin@huawei.com \
    --cc=denis.semakin@huawei-partners.com \
    --cc=hukeping@huawei.com \
    --cc=ilya.hanov@huawei-partners.com \
    --cc=konstantin.meskhidze@huawei.com \
    --cc=krzysztof.struczynski@huawei.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=roberto.sassu@huawei.com \
    --cc=stefanb@linux.ibm.com \
    --cc=yusongping@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