]> git.karo-electronics.de Git - linux-beck.git/commitdiff
apparmor: fix refcount bug in profile replacement
authorJohn Johansen <john.johansen@canonical.com>
Mon, 11 Apr 2016 23:55:10 +0000 (16:55 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Tue, 12 Jul 2016 15:43:10 +0000 (08:43 -0700)
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
security/apparmor/policy.c

index 705c2879d3a94a79e10d1190468483c2f9d7192a..222052f64e2cc127b0a013165cb04f2c0b122160 100644 (file)
@@ -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,