* [PATCH] ima: free the rule label list in ima_free_rule()
@ 2026-11-27 7:29 Cong Nguyen
2026-11-27 7:32 ` sashiko-bot
0 siblings, 1 reply; 2+ messages 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 related [flat|nested] 2+ messages in thread
* Re: [PATCH] ima: free the rule label list in ima_free_rule()
2026-11-27 7:29 [PATCH] ima: free the rule label list in ima_free_rule() Cong Nguyen
@ 2026-11-27 7:32 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-27 7:32 UTC (permalink / raw)
Cc: linux-security-module
> 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>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127072927.172066-1-congnt264@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 7:32 UTC | newest]
Thread overview: 2+ messages (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
2026-11-27 7:32 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox