summaryrefslogtreecommitdiff
path: root/security/apparmor/policy_ns.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2022-10-03 12:48:24 +0300
committerJohn Johansen <john.johansen@canonical.com>2022-10-25 08:35:36 +0300
commit58f89ce58bb4f5cf5963b20a19aaa2431b0412d8 (patch)
treec2d790ece0ee8b71c048c3775a70801e5927acaf /security/apparmor/policy_ns.c
parent1f2bc06a8dbff73957f433b22c6fd35fccfb47a4 (diff)
downloadlinux-58f89ce58bb4f5cf5963b20a19aaa2431b0412d8.tar.xz
apparmor: refactor code that alloc null profiles
Bother unconfined and learning profiles use the null profile as their base. Refactor so they are share a common base routine. This doesn't save much atm but will be important when the feature set of the parent is inherited. Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/policy_ns.c')
-rw-r--r--security/apparmor/policy_ns.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c
index 121aa79bccaa..5c38563a6dcf 100644
--- a/security/apparmor/policy_ns.c
+++ b/security/apparmor/policy_ns.c
@@ -83,18 +83,14 @@ const char *aa_ns_name(struct aa_ns *curr, struct aa_ns *view, bool subns)
static struct aa_profile *alloc_unconfined(const char *name)
{
struct aa_profile *profile;
- struct aa_ruleset *rules;
- profile = aa_alloc_profile(name, NULL, GFP_KERNEL);
+ profile = aa_alloc_null(NULL, name, GFP_KERNEL);
if (!profile)
return NULL;
profile->label.flags |= FLAG_IX_ON_NAME_ERROR |
FLAG_IMMUTIBLE | FLAG_NS_COUNT | FLAG_UNCONFINED;
profile->mode = APPARMOR_UNCONFINED;
- rules = list_first_entry(&profile->rules, typeof(*rules), list);
- rules->file.dfa = aa_get_dfa(nulldfa);
- rules->policy.dfa = aa_get_dfa(nulldfa);
return profile;
}