]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
apparmor: pass gfp param into aa_policy_init()
authorJohn Johansen <john.johansen@canonical.com>
Mon, 16 Jan 2017 08:42:31 +0000 (00:42 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Mon, 16 Jan 2017 09:18:27 +0000 (01:18 -0800)
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/include/lib.h
security/apparmor/lib.c
security/apparmor/policy.c
security/apparmor/policy_ns.c

index 7e81cdab4af0c25a130f54ac6b866dc84afb7132..fa281c2729705af4a6a53d71c70659eef02368f1 100644 (file)
@@ -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 */
index 91d5766d1c287c5bb86a77813802a3744fc56c6f..bcd598c7ca9d1f754162c81c8baf42a781ed8ff9 100644 (file)
@@ -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);
 
index 3b23960b8a5d218a20b0220f8f2517845fba7a9c..5d99fb7ac8815ef0c1bf263a81b4d00707284108 100644 (file)
@@ -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);
 
index e7b7a829532ef988b4d72e44c167d06aac999558..8a5632f397519e4e2c409989b5f90a4fd3f050c7 100644 (file)
@@ -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);