* [PATCH] ima: free the rule label list in ima_free_rule()
@ 2026-11-27 7:29 Cong Nguyen
2026-12-02 11:50 ` Roberto Sassu
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 [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-12-02 11:50 ` Roberto Sassu
0 siblings, 0 replies; 2+ messages in thread
From: Roberto Sassu @ 2026-12-02 11:50 UTC (permalink / raw)
To: Cong Nguyen, Mimi Zohar, Roberto Sassu
Cc: Dmitry Kasatkin, Eric Snowberg, linux-integrity,
linux-security-module, linux-kernel
On Fri, 2026-11-27 at 14:29 +0700, Cong Nguyen wrote:
> 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>
Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
Thanks
Roberto
> ---
> 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);
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 11:51 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-12-02 11:50 ` Roberto Sassu
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®