Skip to content

Commit 3ddae98

Browse files
committed
apparmor: fix memory leak when deduping profile load
AppArmor is leaking the newly loaded profile and its proxy when the profile is an exact match to the currently loaded version. In this case the dedup check results in the profile being skipped and put without dealing with the proxy ref thus not breaking a circular refcount and causing a leak. BugLink: http://bugs.launchpad.net/bugs/1750594 Fixes: 5d5182c ("apparmor: move to per loaddata files, instead of replicating in profiles") Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent 11c92f1 commit 3ddae98

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎security/apparmor/policy.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,9 @@ ssize_t aa_replace_profiles(struct aa_ns *policy_ns, struct aa_label *label,
10081008
audit_policy(label, op, ns_name, ent->new->base.hname,
10091009
"same as current profile, skipping",
10101010
error);
1011+
/* break refcount cycle with proxy. */
1012+
aa_put_proxy(ent->new->label.proxy);
1013+
ent->new->label.proxy = NULL;
10111014
goto skip;
10121015
}
10131016

0 commit comments

Comments
 (0)