From patchwork Tue Aug 23 09:05:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 661782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3sJPh65rJFz9ssP; Tue, 23 Aug 2016 19:06:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bc7fP-0006UU-RQ; Tue, 23 Aug 2016 09:06:43 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bc7fA-0006Kh-VR for kernel-team@lists.ubuntu.com; Tue, 23 Aug 2016 09:06:28 +0000 Received: from static-50-53-49-26.bvtn.or.frontiernet.net ([50.53.49.26] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1bc7fA-0006VX-Cp for kernel-team@lists.ubuntu.com; Tue, 23 Aug 2016 09:06:28 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 07/14] UBUNTU: SAUCE: apparmor: oops in profile_unpack() when policy_db is not present Date: Tue, 23 Aug 2016 02:05:47 -0700 Message-Id: <1471943154-14507-8-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471943154-14507-1-git-send-email-john.johansen@canonical.com> References: <1471943154-14507-1-git-send-email-john.johansen@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/1592547 If unpack_dfa() returns NULL due to the dfa not being present, profile_unpack() is not checking if the dfa is not present (NULL). Signed-off-by: John Johansen --- security/apparmor/policy_unpack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index c62815f..acbcee4 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -658,6 +658,9 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name) error = PTR_ERR(profile->policy.dfa); profile->policy.dfa = NULL; goto fail; + } else if (!profile->policy.dfa) { + error = -EPROTO; + goto fail; } if (!unpack_u32(e, &profile->policy.start[0], "start")) /* default start state */