From d102d895713c736fd13e21feaab38b52d8ab32ad Mon Sep 17 00:00:00 2001 From: John Johansen Date: Mon, 16 Jan 2017 00:42:31 -0800 Subject: [PATCH] apparmor: pass gfp param into aa_policy_init() Signed-off-by: John Johansen --- security/apparmor/include/lib.h | 2 +- security/apparmor/lib.c | 8 ++++---- security/apparmor/policy.c | 2 +- security/apparmor/policy_ns.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/security/apparmor/include/lib.h b/security/apparmor/include/lib.h index 7e81cdab4af0..fa281c272970 100644 --- a/security/apparmor/include/lib.h +++ b/security/apparmor/include/lib.h @@ -194,7 +194,7 @@ static inline struct aa_policy *__policy_strn_find(struct list_head *head, } bool aa_policy_init(struct aa_policy *policy, const char *prefix, - const char *name); + const char *name, gfp_t gfp); void aa_policy_destroy(struct aa_policy *policy); #endif /* AA_LIB_H */ diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c index 91d5766d1c28..bcd598c7ca9d 100644 --- a/security/apparmor/lib.c +++ b/security/apparmor/lib.c @@ -171,20 +171,20 @@ void *__aa_kvmalloc(size_t size, gfp_t flags) * Returns: true if policy init successful */ bool aa_policy_init(struct aa_policy *policy, const char *prefix, - const char *name) + const char *name, gfp_t gfp) { /* freed by policy_free */ if (prefix) { policy->hname = kmalloc(strlen(prefix) + strlen(name) + 3, - GFP_KERNEL); + gfp); if (policy->hname) sprintf((char *)policy->hname, "%s//%s", prefix, name); } else - policy->hname = kstrdup(name, GFP_KERNEL); + policy->hname = kstrdup(name, gfp); if (!policy->hname) return 0; /* base.name is a substring of fqname */ - policy->name = (char *)basename(policy->hname); + policy->name = basename(policy->hname); INIT_LIST_HEAD(&policy->list); INIT_LIST_HEAD(&policy->profiles); diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 3b23960b8a5d..5d99fb7ac881 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -272,7 +272,7 @@ struct aa_profile *aa_alloc_profile(const char *hname) goto fail; kref_init(&profile->proxy->count); - if (!aa_policy_init(&profile->base, NULL, hname)) + if (!aa_policy_init(&profile->base, NULL, hname, GFP_KERNEL)) goto fail; kref_init(&profile->count); diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c index e7b7a829532e..8a5632f39751 100644 --- a/security/apparmor/policy_ns.c +++ b/security/apparmor/policy_ns.c @@ -95,7 +95,7 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name) AA_DEBUG("%s(%p)\n", __func__, ns); if (!ns) return NULL; - if (!aa_policy_init(&ns->base, prefix, name)) + if (!aa_policy_init(&ns->base, prefix, name, GFP_KERNEL)) goto fail_ns; INIT_LIST_HEAD(&ns->sub_ns); -- 2.30.2