From patchwork Sun Jan 15 15:24:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9517525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B9437607D4 for ; Sun, 15 Jan 2017 15:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB7AB2849F for ; Sun, 15 Jan 2017 15:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BE15284A1; Sun, 15 Jan 2017 15:24:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 403582849F for ; Sun, 15 Jan 2017 15:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751054AbdAOPYT (ORCPT ); Sun, 15 Jan 2017 10:24:19 -0500 Received: from mout.web.de ([212.227.15.4]:56234 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbdAOPYT (ORCPT ); Sun, 15 Jan 2017 10:24:19 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Mg7Zl-1c7euB1IP7-00NRTF; Sun, 15 Jan 2017 16:24:06 +0100 Subject: [PATCH 24/46] selinux: Return directly after a failed kzalloc() in cat_read() To: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <04142c87-5826-4796-c461-ec3e80f14928@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:24:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:f8tM57CyLIPvz9mk2gokgFcnTp/IMDZ0mwJMtYywmtlXkqKRg72 CM0Izr+ryEBRu/57KS0ZpN90OY3SClHzDmQG+PstWoWBUV/wTOYkCjJbS5fI8TbXEvj0TvH W48QecBYqrhl4Wm2SQujoYRl2hsALfYIcCYyNgSbtlcoB5rlUaVMuhYMPR8Uo8raXp9XmGr 6g1EgT87oLxSDYRqHEv9g== X-UI-Out-Filterresults: notjunk:1; V01:K0:D/chuB3ZCCo=:zqh41RA5urFzND1Kj9OHAj 84C7MWgrb5OcnMs+JYA4rbG7RzjewLf4FrxJ6oMukNxetV6RdB98UJnIdawcTUmIdsLIVRL/z sCYOjA2IqVx5tghdVjU/+4xOB/dfXd6WSVy0XKsUPk5pkZ8Zu4kRLSuNam2/w2p/N+VUNy05m vPH0Pt2aewyxnl3oD/uFiDZyO81eZfHNOOOkQxRpM/eek3JmYSCH2OfxL70JGFF8CkvOzlvGJ oo7bD2Jz1/Bx+C4xb3CFPqiISdBcnAH5ggTUkgV52LkjXrA/sdk9o8C0fgWpD7eHouzVolrRo 6qNw1OsTAWgtNEtoNSe1K2/W7DybLAyDWgvUy2OQewAo+JL8r3QUmKmMF8k6E0EPTXqqInxdg InGAdwY72boPTI+IcalRAyTZVksg0bZfUjlL4RXh+2Xqav0gBvWTSEwniIaQXFcvGfUfJwPaa poX/Jsmq3HKPeKWhXHTidwUeLqU9uo2mWw7smgvGD8JC5reBQQCkGLmHIpf/F3t7O66zkPRZl c9taJC4Ds7ra+KMRY6dAKEqPw8lz1qT2C+P8AbiK6AwuK+xx4XGn9L7udRYRv75MmO7IrRM37 6/9ySZ7k4TQkvV+i9RPAUadVd8qOAaOVn/Fz7Ht/Ac3VKeatZe+GeGPUzLolsFZsXY4cbVKyH OxA3g4ZntqERUA9PeENhXEgnccCLW4ddemzS1okzGz8Z5ce+lFlorBnV9a6uEYHjYrc1q6AWD DYkytVb2j7lNkmQfnhLEBos1Vth380D542KYJOFjJVeOhLPqCyi923HSQmpvTWkALNpzaF2tT oFhKA+V Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 14 Jan 2017 21:20:43 +0100 Return directly after a call of the function "kzalloc" failed at the beginning. Signed-off-by: Markus Elfring --- security/selinux/ss/policydb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 5101592ae172..eb898dcbe502 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1635,10 +1635,9 @@ static int cat_read(struct policydb *p, struct hashtab *h, void *fp) __le32 buf[3]; u32 len; - rc = -ENOMEM; catdatum = kzalloc(sizeof(*catdatum), GFP_ATOMIC); if (!catdatum) - goto bad; + return -ENOMEM; rc = next_entry(buf, fp, sizeof buf); if (rc)