[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101126151847.GA2721@localhost.localdomain>
Date:	Fri, 26 Nov 2010 23:18:47 +0800
From:	wzt.wzt@...il.com
To:	linux-kernel@...r.kernel.org
Cc:	john.johansen@...onical.com, apparmor@...ts.ubuntu.com,
	linux-security-module@...r.kernel.org
Subject: [PATCH] APPARMOR: Fix NULL Pointer dereference while __add_new_profile
In aa_replace_profiles(), if __lookup_parent() path failed, policy is set 
to NULL and goto audit label, old_profile and rename_profile are both NULL,
__add_new_profile is called, the parameter policy is NULL, it will cause
NULL pointer dereference via __list_add_profile(&policy->profiles, profile);
Signed-off-by: Zhitong Wang <zhitong.wangzt@...baba-inc.com>
---
 security/apparmor/policy.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 52cc865..832d9e9 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -940,6 +940,8 @@ static int replacement_allowed(struct aa_profile *profile, int noreplace,
 static void __add_new_profile(struct aa_namespace *ns, struct aa_policy *policy,
 			      struct aa_profile *profile)
 {
+	if (!policy)
+		return ;
 	if (policy != &ns->base)
 		/* released on profile replacement or free_profile */
 		profile->parent = aa_get_profile((struct aa_profile *) policy);
-- 
1.6.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
