Commit 93e7aa83 authored by John Johansen's avatar John Johansen Committed by Tim Gardner

Revert "UBUNTU: SAUCE: apparmor: Fix: ensure new labels resulting from merge have a replacedby"

BugLink: http://bugs.launchpad.net/bugs/1379535

This reverts commit 2928259cc7e695219d348927e7557e4a83fc92c8.
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 8812fb2d
...@@ -652,7 +652,7 @@ struct aa_label *aa_label_find(struct aa_labelset *ls, struct aa_label *l) ...@@ -652,7 +652,7 @@ struct aa_label *aa_label_find(struct aa_labelset *ls, struct aa_label *l)
* @replace: whether this insertion should replace an existing entry if present * @replace: whether this insertion should replace an existing entry if present
* Requires: @ls->lock * Requires: @ls->lock
* caller to hold a valid ref on l * caller to hold a valid ref on l
* if @replace is true l has a preallocated replacedby associated *
* Returns: @l if successful in inserting @l - with additional refcount * Returns: @l if successful in inserting @l - with additional refcount
* else ref counted equivalent label that is already in the set, * else ref counted equivalent label that is already in the set,
the else condition only happens if @replace is false the else condition only happens if @replace is false
...@@ -676,18 +676,9 @@ static struct aa_label *__aa_label_insert(struct aa_labelset *ls, ...@@ -676,18 +676,9 @@ static struct aa_label *__aa_label_insert(struct aa_labelset *ls,
parent = *new; parent = *new;
if (result == 0) { if (result == 0) {
labelsetstats_inc(ls, existing); labelsetstats_inc(ls, existing);
if (!replace) { if (!replace && aa_get_label_not0(this))
if (aa_get_label_not0(this)) return this;
return this; /* *this is either queued for destruction or being replaced */
/* queued for destruction, in place replace */
} else {
if (this->replacedby) {
free_replacedby(l->replacedby);
l->replacedby = aa_get_replacedby(this->replacedby);
__aa_update_replacedby(this, l);
} else
this->replacedby = aa_get_replacedby(l->replacedby);
}
AA_BUG(!__aa_label_replace(ls, this, l)); AA_BUG(!__aa_label_replace(ls, this, l));
return aa_get_label(l); return aa_get_label(l);
} else if (result < 0) } else if (result < 0)
...@@ -910,8 +901,6 @@ static int aa_sort_and_merge_profiles(int n, struct aa_profile **ps) ...@@ -910,8 +901,6 @@ static int aa_sort_and_merge_profiles(int n, struct aa_profile **ps)
* @a: label to merge with @b (NOT NULL) * @a: label to merge with @b (NOT NULL)
* @b: label to merge with @a (NOT NULL) * @b: label to merge with @a (NOT NULL)
* *
* Requires: preallocated replacedby
*
* Returns: ref counted label either l if merge is unique * Returns: ref counted label either l if merge is unique
* a if b is a subset of a * a if b is a subset of a
* b if a is a subset of b * b if a is a subset of b
...@@ -1101,7 +1090,6 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b, ...@@ -1101,7 +1090,6 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b,
if (!label) { if (!label) {
struct aa_label *new; struct aa_label *new;
struct aa_replacedby *r;
a = aa_get_newest_label(a); a = aa_get_newest_label(a);
b = aa_get_newest_label(b); b = aa_get_newest_label(b);
...@@ -1112,13 +1100,7 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b, ...@@ -1112,13 +1100,7 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b,
new = aa_label_alloc(a->size + b->size, gfp); new = aa_label_alloc(a->size + b->size, gfp);
if (!new) if (!new)
goto out; goto out;
r = aa_alloc_replacedby(new);
if (!r) {
aa_label_free(new);
goto out;
}
/* only label update will set replacedby so ns lock is enough */
new->replacedby = r;
write_lock_irqsave(&ls->lock, flags); write_lock_irqsave(&ls->lock, flags);
label = __label_merge_insert(ls, new, a, b); label = __label_merge_insert(ls, new, a, b);
write_unlock_irqrestore(&ls->lock, flags); write_unlock_irqrestore(&ls->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment