From patchwork Tue Mar 30 17:39:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 49001 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 07337B7CF0 for ; Wed, 31 Mar 2010 04:39:32 +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 1NwfPS-0008B7-6h; Tue, 30 Mar 2010 18:39:26 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NwfPP-00089Z-5A for kernel-team@lists.ubuntu.com; Tue, 30 Mar 2010 18:39:23 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NwfPP-0006XO-3t for ; Tue, 30 Mar 2010 18:39:23 +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 1NwfPO-0004eF-Nb for kernel-team@lists.ubuntu.com; Tue, 30 Mar 2010 18:39:23 +0100 From: john.johansen@canonical.com To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/4] UBUNTU: SAUCE: AppArmor: Fix oops in profile verification if profile unpack fails. Date: Tue, 30 Mar 2010 10:39:10 -0700 Message-Id: <1269970750-25624-5-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 Profile verification should not be run if profile unpack fails, as this will cause an oops trying to dereference invalid data. Signed-off-by: John Johansen --- security/apparmor/policy_unpack.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 20bdf9c..a475d7c 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -707,9 +707,10 @@ struct aa_profile *aa_unpack(void *udata, size_t size, return ERR_PTR(error); profile = unpack_profile(&e, sa); - if (IS_ERR(profile)) + if (IS_ERR(profile)) { sa->pos = e.pos - e.start; - + return profile; + } error = verify_profile(profile, sa); if (error) { aa_put_profile(profile);