[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230310231107.10954-2-mirsad.todorovac@alu.unizg.hr>
Date: Sat, 11 Mar 2023 00:11:10 +0100
From: Mirsad Goran Todorovac <mirsad.todorovac@....unizg.hr>
To: Paul Moore <paul@...l-moore.com>,
Roberto Sassu <roberto.sassu@...wei.com>,
linux-kernel@...r.kernel.org
Cc: Mirsad Goran Todorovac <mirsad.todorovac@....unizg.hr>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mimi Zohar <zohar@...ux.ibm.com>,
Thomas Weißschuh <linux@...ssschuh.net>,
Casey Schaufler <casey@...aufler-ca.com>,
Christian Göttsche <cgzones@...glemail.com>,
Mickaël Salaün <mic@...ikod.net>,
Frederick Lawler <fred@...udflare.com>
Subject: [PATCH v1 2/2] integrity: Add the release() hook to the integrity LSM module
The kmem_cache_create() callback in the init() hook of the integrity LSM
module doesn't have a corresponding kmem_cache_destroy() function call.
The allocated cache is destroyed on kernel shutdown in an undefined manner.
This patch should define a proper destructor to deallocate resource in a
well-behaved, defined order.
Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@....unizg.hr>
Suggested-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Mimi Zohar <zohar@...ux.ibm.com>
Cc: Paul Moore <paul@...l-moore.com>
Cc: Thomas Weißschuh <linux@...ssschuh.net>
Cc: Casey Schaufler <casey@...aufler-ca.com>
Cc: Christian Göttsche <cgzones@...glemail.com>
Cc: Mickaël Salaün <mic@...ikod.net>
Cc: Frederick Lawler <fred@...udflare.com>
---
security/integrity/iint.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/security/integrity/iint.c b/security/integrity/iint.c
index 8638976f7990..3f69eb702b2e 100644
--- a/security/integrity/iint.c
+++ b/security/integrity/iint.c
@@ -179,9 +179,16 @@ static int __init integrity_iintcache_init(void)
0, SLAB_PANIC, init_once);
return 0;
}
+
+static int __exit integrity_iintcache_release(void)
+{
+ kmem_cache_destroy(iint_cache);
+}
+
DEFINE_LSM(integrity) = {
.name = "integrity",
.init = integrity_iintcache_init,
+ .release = integrity_iintcache_release,
};
--
2.30.2
Powered by blists - more mailing lists