Patchwork [4/4] UBUNTU: SAUCE: AppArmor: Fix refcounting bug causing leak of creds

login
register
mail settings
Submitter John Johansen
Date Nov. 9, 2009, 8:41 p.m.
Message ID <1257799316-12573-5-git-send-email-john.johansen@canonical.com>
Download mbox | patch
Permalink /patch/38034/
State Superseded
Headers show

Comments

John Johansen - Nov. 9, 2009, 8:41 p.m.
BugLink: http://bugs.launchpad.net/bugs/479115

AppArmor when doing ptrace check for domain changes, fails to drop
the ref count on the task creds when it is unconfined.

Signed-off-by: John Johansen <john.johansen@canonical.com>
---
 ubuntu/apparmor/domain.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/ubuntu/apparmor/domain.c b/ubuntu/apparmor/domain.c
index 0594ea2..95cf5f5 100644
--- a/ubuntu/apparmor/domain.c
+++ b/ubuntu/apparmor/domain.c
@@ -65,9 +65,10 @@  static int aa_may_change_ptraced_domain(struct task_struct *task,
 	rcu_read_unlock();
 
 	if (!tracerp)
-		return error;
+		goto out;
 
 	error = aa_may_ptrace(tracer, tracerp, to_profile, PTRACE_MODE_ATTACH);
+out:
 	put_cred(cred);
 
 	return error;