From: John Johansen Date: Mon, 11 Apr 2016 23:55:10 +0000 (-0700) Subject: apparmor: fix refcount bug in profile replacement X-Git-Tag: v4.14-rc1~2771^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dcda617a0c5160c73e0aa02813c871339ea08004;p=platform%2Fkernel%2Flinux-rpi.git apparmor: fix refcount bug in profile replacement Signed-off-by: John Johansen Acked-by: Seth Arnold --- diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 705c287..222052f 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -1189,12 +1189,12 @@ ssize_t aa_replace_profiles(void *udata, size_t size, bool noreplace) aa_get_profile(newest); aa_put_profile(parent); rcu_assign_pointer(ent->new->parent, newest); - } else - aa_put_profile(newest); + } /* aafs interface uses replacedby */ rcu_assign_pointer(ent->new->replacedby->profile, aa_get_profile(ent->new)); __list_add_profile(&parent->base.profiles, ent->new); + aa_put_profile(newest); } else { /* aafs interface uses replacedby */ rcu_assign_pointer(ent->new->replacedby->profile,