[08/11] UBUNTU: SAUCE: apparmor: fix ns ref count link when removing profiles from policy

Message ID 20170331125744.16986-9-john.johansen@canonical.com
State New
Headers show

Commit Message

John Johansen March 31, 2017, 12:57 p.m.
BugLink: http://bugs.launchpad.net/bugs/1660849
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 security/apparmor/policy.c | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index afa5984..f2ffcf1 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -1104,11 +1104,13 @@  ssize_t aa_remove_profiles(struct aa_ns *view, struct aa_label *label,
 
 	/* don't fail removal if audit fails */
 	(void) audit_policy(label, OP_PROF_RM, ns_name, name, info, error);
+	aa_put_ns(ns);
 	aa_put_profile(profile);
 	return size;
 
 fail_ns_lock:
 	mutex_unlock(&ns->lock);
+	aa_put_ns(ns);
 
 fail:
 	(void) audit_policy(label, OP_PROF_RM, ns_name, name, info, error);