summaryrefslogtreecommitdiff
path: root/security/apparmor/policy.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-06-09 07:09:05 -0700
committerJohn Johansen <john.johansen@canonical.com>2017-06-10 17:11:35 -0700
commita1bd627b46d169268a0ee5960899fb5be960a317 (patch)
treeddcc330c5ddc6efb5e18f1943a55ce4e11884743 /security/apparmor/policy.c
parentcf797c0e5e312520b0b9f0367039fc0279a07a76 (diff)
apparmor: share profile name on replacement
The profile names are the same, leverage this. Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/policy.c')
-rw-r--r--security/apparmor/policy.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 29e04638790f..af925c07ad4e 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -829,6 +829,14 @@ static int __lookup_replace(struct aa_ns *ns, const char *hname,
return 0;
}
+static void share_name(struct aa_profile *old, struct aa_profile *new)
+{
+ aa_put_str(new->base.hname);
+ aa_get_str(old->base.hname);
+ new->base.hname = old->base.hname;
+ new->base.name = old->base.name;
+}
+
/**
* aa_replace_profiles - replace profile(s) on the profile list
* @policy_ns: namespace load is occurring on
@@ -1013,6 +1021,7 @@ ssize_t aa_replace_profiles(struct aa_ns *policy_ns, struct aa_profile *profile,
NULL, error);
if (ent->old) {
+ share_name(ent->old, ent->new);
__replace_profile(ent->old, ent->new, 1);
if (ent->rename) {
/* aafs interface uses proxy */