mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ima: free the rule label list in ima_free_rule()
@ 2026-11-27  7:29 Cong Nguyen
  0 siblings, 0 replies; only message in thread
From: Cong Nguyen @ 2026-11-27  7:29 UTC (permalink / raw)
  To: Mimi Zohar, Roberto Sassu
  Cc: Dmitry Kasatkin, Eric Snowberg, linux-integrity,
	linux-security-module, linux-kernel

ima_parse_rule() allocates entry->label as an option list, like
entry->keyrings, but ima_free_rule() only frees entry->keyrings. The label
list is leaked when a rule is freed, for example when a policy write
containing "label=" is rejected.

Free entry->label next to the keyrings list.

Fixes: 47d76a484050 ("IMA: limit critical data measurement based on a label")
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
 security/integrity/ima/ima_policy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 2dc1d93aa768..c3c4faa99f5f 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -410,6 +410,7 @@ static void ima_free_rule(struct ima_rule_entry *entry)
 	kfree(entry->fsname);
 	kfree(entry->fs_subtype);
 	ima_free_rule_opt_list(entry->keyrings);
+	ima_free_rule_opt_list(entry->label);
 	ima_lsm_free_rule(entry);
 	kfree(entry);
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-27  7:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  7:29 [PATCH] ima: free the rule label list in ima_free_rule() Cong Nguyen

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®