Commit 68d119f3 authored by John Johansen's avatar John Johansen Committed by Tim Gardner

UBUNTU: SAUCE: apparmor: Fix: ensure aa_get_newest will trip debugging if the...

UBUNTU: SAUCE: apparmor: Fix: ensure aa_get_newest will trip debugging if the replacedby is not setup

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

While we are at it, also catch any potential refcounting errors arround
the replacedby label dereference.
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent ebc616b9
......@@ -384,8 +384,17 @@ static inline struct aa_label *aa_get_newest_label(struct aa_label *l)
if (!l)
return NULL;
if (label_invalid(l))
return aa_get_label_rcu(&l->replacedby->label);
if (label_invalid(l)) {
struct aa_label *tmp;
AA_BUG(!l->replacedby);
AA_BUG(!l->replacedby->label);
/* BUG: only way this can happen is @l ref count and its
* replacement count have gone to 0 and are on their way
* to destruction. ie. we have a refcounting error
*/
AA_BUG(!(tmp = aa_get_label_rcu(&l->replacedby->label)));
return tmp;
}
return aa_get_label(l);
}
......
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