aboutsummaryrefslogtreecommitdiffstats
path: root/security/apparmor/policy.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/apparmor/policy.c')
-rw-r--r--security/apparmor/policy.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 0ceee967434c..aee2e71827cd 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -329,30 +329,6 @@ static void free_namespace(struct aa_namespace *ns)
329} 329}
330 330
331/** 331/**
332 * aa_free_namespace_rcu - free aa_namespace by rcu
333 * @head: rcu_head callback for freeing of a profile (NOT NULL)
334 *
335 * rcu_head is to the unconfined profile associated with the namespace
336 */
337static void aa_free_namespace_rcu(struct rcu_head *head)
338{
339 struct aa_profile *p = container_of(head, struct aa_profile, base.rcu);
340 free_namespace(p->ns);
341}
342
343/**
344 * aa_free_namespace_kref - free aa_namespace by kref (see aa_put_namespace)
345 * @kr: kref callback for freeing of a namespace (NOT NULL)
346 *
347 * kref is to the unconfined profile associated with the namespace
348 */
349void aa_free_namespace_kref(struct kref *kref)
350{
351 struct aa_profile *p = container_of(kref, struct aa_profile, count);
352 call_rcu(&p->base.rcu, aa_free_namespace_rcu);
353}
354
355/**
356 * __aa_find_namespace - find a namespace on a list by @name 332 * __aa_find_namespace - find a namespace on a list by @name
357 * @head: list to search for namespace on (NOT NULL) 333 * @head: list to search for namespace on (NOT NULL)
358 * @name: name of namespace to look for (NOT NULL) 334 * @name: name of namespace to look for (NOT NULL)
@@ -632,8 +608,11 @@ static void free_profile(struct aa_profile *profile)
632 */ 608 */
633static void aa_free_profile_rcu(struct rcu_head *head) 609static void aa_free_profile_rcu(struct rcu_head *head)
634{ 610{
635 struct aa_profile *p = container_of(head, struct aa_profile, base.rcu); 611 struct aa_profile *p = container_of(head, struct aa_profile, rcu);
636 free_profile(p); 612 if (p->flags & PFLAG_NS_COUNT)
613 free_namespace(p->ns);
614 else
615 free_profile(p);
637} 616}
638 617
639/** 618/**
@@ -643,7 +622,7 @@ static void aa_free_profile_rcu(struct rcu_head *head)
643void aa_free_profile_kref(struct kref *kref) 622void aa_free_profile_kref(struct kref *kref)
644{ 623{
645 struct aa_profile *p = container_of(kref, struct aa_profile, count); 624 struct aa_profile *p = container_of(kref, struct aa_profile, count);
646 call_rcu(&p->base.rcu, aa_free_profile_rcu); 625 call_rcu(&p->rcu, aa_free_profile_rcu);
647} 626}
648 627
649/** 628/**