Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

apparmor: make free_profile available outside of policy.c

Signed-off-by: John Johansen <john.johansen@canonical.com>

+7 -7
+1
security/apparmor/include/policy.h
··· 228 228 void aa_free_replacedby_kref(struct kref *kref); 229 229 struct aa_profile *aa_alloc_profile(const char *name); 230 230 struct aa_profile *aa_new_null_profile(struct aa_profile *parent, int hat); 231 + void aa_free_profile(struct aa_profile *profile); 231 232 void aa_free_profile_kref(struct kref *kref); 232 233 struct aa_profile *aa_find_child(struct aa_profile *parent, const char *name); 233 234 struct aa_profile *aa_lookup_profile(struct aa_namespace *ns, const char *name);
+4 -5
security/apparmor/policy.c
··· 307 307 return NULL; 308 308 } 309 309 310 - static void free_profile(struct aa_profile *profile); 311 310 /** 312 311 * free_namespace - free a profile namespace 313 312 * @ns: the namespace to free (MAYBE NULL) ··· 323 324 aa_put_namespace(ns->parent); 324 325 325 326 ns->unconfined->ns = NULL; 326 - free_profile(ns->unconfined); 327 + aa_free_profile(ns->unconfined); 327 328 kzfree(ns); 328 329 } 329 330 ··· 567 568 } 568 569 569 570 /** 570 - * free_profile - free a profile 571 + * aa_free_profile - free a profile 571 572 * @profile: the profile to free (MAYBE NULL) 572 573 * 573 574 * Free a profile, its hats and null_profile. All references to the profile, ··· 576 577 * If the profile was referenced from a task context, free_profile() will 577 578 * be called from an rcu callback routine, so we must not sleep here. 578 579 */ 579 - static void free_profile(struct aa_profile *profile) 580 + void aa_free_profile(struct aa_profile *profile) 580 581 { 581 582 AA_DEBUG("%s(%p)\n", __func__, profile); 582 583 ··· 611 612 if (p->flags & PFLAG_NS_COUNT) 612 613 free_namespace(p->ns); 613 614 else 614 - free_profile(p); 615 + aa_free_profile(p); 615 616 } 616 617 617 618 /**
+2 -2
security/apparmor/policy_unpack.c
··· 616 616 else if (!name) 617 617 name = "unknown"; 618 618 audit_iface(profile, name, "failed to unpack profile", e, error); 619 - aa_put_profile(profile); 619 + aa_free_profile(profile); 620 620 621 621 return ERR_PTR(error); 622 622 } ··· 763 763 764 764 error = verify_profile(profile); 765 765 if (error) { 766 - aa_put_profile(profile); 766 + aa_free_profile(profile); 767 767 goto fail; 768 768 } 769 769