From patchwork Thu Jul 31 03:26:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damian Hobson-Garcia X-Patchwork-Id: 4652941 Return-Path: X-Original-To: patchwork-ltsi-dev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7FA36C0338 for ; Thu, 31 Jul 2014 03:27:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C25A4201B4 for ; Thu, 31 Jul 2014 03:27:16 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC26E2015E for ; Thu, 31 Jul 2014 03:27:15 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [IPv6:::1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2CF43A59; Thu, 31 Jul 2014 03:27:05 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C9FC4A4C for ; Thu, 31 Jul 2014 03:27:04 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id EBD782010C for ; Thu, 31 Jul 2014 03:27:03 +0000 (UTC) Received: by mail-pa0-f48.google.com with SMTP id et14so2728122pad.21 for ; Wed, 30 Jul 2014 20:27:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+MXlv347TcPiKtvjC9LEJ1kq2+0vDF3QaEagj8QjdpI=; b=EN+vkac4WXp/sDsVN6b8pPf/oUSMaiGqjMJacqVqs1Nn+FVE4PAfoQZMdOblegZFrh vQr1/1WL/VQUxBQt+9udTIiGwtEoK9eTWGfQjOErihoNz0heOkeWrYwAQmo23FzwZcda xip5GfrV3tWlsJwK9irwSSRZZjB9h5Be59JGCi/679R0kGMlmFevh5RC1pHX1+2PQYd4 L4y9C3/caM0Ta6Xtedr9nIMtvtkdiBUSv4I+hHbeKwGP0LvUyw17vSxOukpdWGN9fPHo GmL9dqwcLzvwYdW7a45YH8K4BYa+GzzBWPIuFQAny7K2LFRmO2MNd/oDnGLWH40vyx3/ Avag== X-Gm-Message-State: ALoCoQlDaRlh0KiCz77Ng77Fd8ALv65Zl4mN0CS54640HY2QgPKOtYfaHtjl2ysAvCmYzMPGv6l7 X-Received: by 10.66.142.42 with SMTP id rt10mr1246650pab.1.1406777223159; Wed, 30 Jul 2014 20:27:03 -0700 (PDT) Received: from v400.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id d13sm3843861pbu.72.2014.07.30.20.27.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 20:27:02 -0700 (PDT) From: Damian Hobson-Garcia To: ltsi-dev@lists.linuxfoundation.org Date: Thu, 31 Jul 2014 12:26:38 +0900 Message-Id: <1406777210-28425-5-git-send-email-dhobsong@igel.co.jp> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406777210-28425-1-git-send-email-dhobsong@igel.co.jp> References: <1406777210-28425-1-git-send-email-dhobsong@igel.co.jp> X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Subject: [LTSI-dev] [PATCH 04/16] Smack: Fix possible NULL pointer dereference at smk_netlbl_mls() X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tetsuo Handa netlbl_secattr_catmap_alloc(GFP_ATOMIC) can return NULL. Signed-off-by: Tetsuo Handa (cherry picked from commit 8cd77a0bd4b4a7d02c2a6926a69585d8088ee721) Signed-off-by: Damian Hobson-Garcia Signed-off-by: Tomohito Esaki --- security/smack/smack_access.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index 53f2327..6a0377f 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c @@ -403,6 +403,8 @@ int smk_netlbl_mls(int level, char *catset, struct netlbl_lsm_secattr *sap, sap->flags |= NETLBL_SECATTR_MLS_CAT; sap->attr.mls.lvl = level; sap->attr.mls.cat = netlbl_secattr_catmap_alloc(GFP_ATOMIC); + if (!sap->attr.mls.cat) + return -ENOMEM; sap->attr.mls.cat->startbit = 0; for (cat = 1, cp = catset, byte = 0; byte < len; cp++, byte++)