]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
apparmor: fix put() parent ref after updating the active ref
authorJohn Johansen <john.johansen@canonical.com>
Sat, 16 Apr 2016 20:59:02 +0000 (13:59 -0700)
committerJiri Slaby <jslaby@suse.cz>
Fri, 27 Jan 2017 10:16:09 +0000 (11:16 +0100)
commit f351841f8d41072e741e45299070d421a5833a4a upstream.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
security/apparmor/policy.c

index c92a9f6c1be5d6b7dbfab321ca70234a335560d5..455c9f89f7e2eda3491f6610c5e6e5f878b1d3b9 100644 (file)
@@ -1187,8 +1187,8 @@ ssize_t aa_replace_profiles(void *udata, size_t size, bool noreplace)
                        /* parent replaced in this atomic set? */
                        if (newest != parent) {
                                aa_get_profile(newest);
-                               aa_put_profile(parent);
                                rcu_assign_pointer(ent->new->parent, newest);
+                               aa_put_profile(parent);
                        }
                        /* aafs interface uses replacedby */
                        rcu_assign_pointer(ent->new->replacedby->profile,