summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2026-03-01 12:29:06 -0800
committerJohn Johansen <john.johansen@canonical.com>2026-06-13 20:14:07 -0700
commitb9b864fc72367ffdbe79b7952518573e9d209844 (patch)
treea62f992acebd7ee467b253727790220ff866f781 /security
parent32e92764d6f8d251c1bca62be33793287b453a81 (diff)
downloadlinux-2.6-b9b864fc72367ffdbe79b7952518573e9d209844.tar.gz
linux-2.6-b9b864fc72367ffdbe79b7952518573e9d209844.zip
apparmor: free rawdata as soon as possible
profiles can be pinned by file and other references, and can live long after they have been replaced/removed. The rawdata however is no longer needed, and can be freed earlier than the rest of the profile. Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/policy.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index b6a5eb4021db..1739a9de9893 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -232,6 +232,13 @@ static void __remove_profile(struct aa_profile *profile)
aa_label_remove(&profile->label);
__aafs_profile_rmdir(profile);
__list_remove_profile(profile);
+ /* rawdata is only ever referenced by fs lookup, that is no
+ * longer possible here, so put the reference to it. This will
+ * enable the rawdata to be freed if for some reason the profile
+ * is pinned and going to live for a while.
+ */
+ aa_put_profile_loaddata(profile->rawdata);
+ profile->rawdata = NULL;
}
/**