From patchwork Tue Mar 30 17:39:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 48998 X-Patchwork-Delegate: apw@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 61DB8B7C8E for ; Wed, 31 Mar 2010 04:39:23 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NwfPJ-00086J-NY; Tue, 30 Mar 2010 18:39:17 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NwfPG-0007zz-WA for kernel-team@lists.ubuntu.com; Tue, 30 Mar 2010 18:39:15 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NwfPG-0006Lu-SW for ; Tue, 30 Mar 2010 18:39:14 +0100 Received: from [96.225.230.137] (helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1NwfPG-0004e6-Fd for kernel-team@lists.ubuntu.com; Tue, 30 Mar 2010 18:39:14 +0100 From: john.johansen@canonical.com To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/4] AppArmor: Remove null_profile's use of PFLAG_NO_LIST_REF Date: Tue, 30 Mar 2010 10:39:07 -0700 Message-Id: <1269970750-25624-2-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1269970750-25624-1-git-send-email-john.johansen@canonical.com> References: <1269970750-25624-1-git-send-email-john.johansen@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: John Johansen Buglink: http://launchpad.net/bugs/539437 null_profile's currently have a list ref so they should not be using the PFLAG_NO_LIST_REF flag, which prevent them from having their references put correctly resulting in a leak. Signed-off-by: John Johansen --- security/apparmor/policy.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index a3b6dc4..a92ad82 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -229,10 +229,7 @@ static struct aa_namespace *aa_alloc_namespace(const char *name) INIT_LIST_HEAD(&ns->sub_ns); rwlock_init(&ns->lock); - /* - * null profile is not added to the profile list, - * released by aa_free_namespace - */ + /* released by aa_free_namespace */ ns->unconfined = aa_alloc_profile("unconfined"); if (!ns->unconfined) goto fail_unconfined; @@ -631,7 +628,7 @@ struct aa_profile *aa_new_null_profile(struct aa_profile *parent, int hat) profile->sid = sid; profile->mode = APPARMOR_COMPLAIN; - profile->flags = PFLAG_NULL | PFLAG_NO_LIST_REF; + profile->flags = PFLAG_NULL; if (hat) profile->flags |= PFLAG_HAT;