From patchwork Sun Jan 15 15:35: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: 9517569 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 229DF601DA for ; Sun, 15 Jan 2017 15:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 131D127E3E for ; Sun, 15 Jan 2017 15:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0433528387; Sun, 15 Jan 2017 15:35:18 +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 9F0CB27E3E for ; Sun, 15 Jan 2017 15:35:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751129AbdAOPfQ (ORCPT ); Sun, 15 Jan 2017 10:35:16 -0500 Received: from mout.web.de ([212.227.15.4]:59736 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdAOPfP (ORCPT ); Sun, 15 Jan 2017 10:35:15 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MbhSP-1cC4va3wd3-00J3nO; Sun, 15 Jan 2017 16:35:04 +0100 Subject: [PATCH 35/46] selinux: Return directly after a failed kzalloc() in perm_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: Date: Sun, 15 Jan 2017 16:35: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:tWaprOUo16C/Zf1LO23/YsO8gBL0lFK35/PQB2MdantAqvA0N0Z UySi5GscYr1d1Jn/FKn9TbQAUETp6hfmiNhvMvLG349/Cr9iaSa+iVOTsWTxjusKFWBVFl3 s/5CiX8lWmU7teys7sDUTeg2H3FjZHe5Q6jHYeQtk95kVhkS7RfbEB3Ar0cICxctg92FodI tDHpMgGDH72anVbwEN0YA== X-UI-Out-Filterresults: notjunk:1; V01:K0:9sjTIjPy66Q=:Mb5S0clXNujG9r6zutYzLd 6yAYOWCNGMiNJ2CH2KPLzgFNT8XzdlY55N0Vp5+7wX+oQi4NoFGQ1wPrF3hN/q90HjUKdd0re GpK9GT4qZWxaoxvwTZADOZEATyvtyilicPDSLi1bE+cJv5Gj+MypOGFiMO/ycMn/oIKWDvnm/ 1g04VZmEN+qIwvhiXRxUkVVU9qezGDbLjjRG/pBFIJuqoTVT0oEGIeeWVOUv6xgY7p9qUObRw Wm+NxwWdAlK6rYPCJ1m4HvFu9/1MWnV+jG/pSFl13d9ELrvB7DhSRADUEwwPOPX+s5GvfX+5D sTt9l0FpwgzMcxiuEKXLUvieyzvY0vIjLy/Yp88C634mypxvsF58IqG7AyRVhYKn30cWJdPUA kpPWTRFMOFT2DD3MLhrXVi/8qdDPLBrQfkc00D+4vgZchqD0Y6LojsKmykOba4K3cPAeXjwdy khyOYHdNRn6xq+EptayScv071BP9KTZKDF+4E8PremqaQmeNqR5Jo6Vsqy55NNw4r7U1pJ0tJ fX5v+PeVpP9kjFpD+rLO3LfkeJTVItooSyyGaqvHisM5Lij0zPI2XV7wVW6P5Ssj2kVMDKr78 9z+mFtXD6QJujp95gfG6tsO+FT+K0G1QvTjwjNGVHuEbTyAO4CSAsZfKQOUWM2BzvPBaEhbql HRkga//5iE0mAc/Wt2ApBQp+OqE5e2LKuRcWLk0Z+B8mCvkWRyN0CDbSRp/CMnai/e4+YloEE 4GrWcrHTcrarj8HTVwgbjKdTywtBl+1lqHTxXpomx9y6To1cRGzTK+30SufSTQxcd5uSqZIUD rcwGZdUZXHnYjojimdvYybbAhRQACRqCURjkiKAXSGVw+dpPcGiko+HM5khN/XfCluKnmpvJv 7X+u+eOZVjPxh+P2LLn+bHZRKnSIxgJ/3XtlPfFlYM7qAtmc8eKdSxr1CI7a01cg6IuZYP3CV 7Z2Ma+SyJKLxFJdDmM212AoFZqgaHHTfBBCTYHhelHdsJ5qP2B2v3 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 15 Jan 2017 11:20:13 +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 551685283399..9b595f2e0d9f 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1116,10 +1116,9 @@ static int perm_read(struct policydb *p, struct hashtab *h, void *fp) __le32 buf[2]; u32 len; - rc = -ENOMEM; perdatum = kzalloc(sizeof(*perdatum), GFP_KERNEL); if (!perdatum) - goto bad; + return -ENOMEM; rc = next_entry(buf, fp, sizeof buf); if (rc)