From patchwork Sun Jan 15 15:40:07 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: 9517589 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 E2F2A618AA for ; Sun, 15 Jan 2017 15:40:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4CB428387 for ; Sun, 15 Jan 2017 15:40:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C991F283AC; Sun, 15 Jan 2017 15:40:24 +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 7904328387 for ; Sun, 15 Jan 2017 15:40:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751245AbdAOPkX (ORCPT ); Sun, 15 Jan 2017 10:40:23 -0500 Received: from mout.web.de ([212.227.15.14]:59867 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdAOPkW (ORCPT ); Sun, 15 Jan 2017 10:40:22 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LyftH-1cXP2M0jsl-016AOM; Sun, 15 Jan 2017 16:40:09 +0100 Subject: [PATCH 40/46] selinux: Return directly after a failed kzalloc() in roles_init() 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: <2c370330-a80c-9879-2013-3a99a21dc06d@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:40:07 +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:BUTa/stV5+EUjWS3uxLv/5zu8KvBJmPzbKUoJeqs216X2IbkuJA VMFDy8FNHx8YbGU2AfvffM1ymO6RJjlwUQD0bmbtnElqf4kDeVONkyoppv2NaJbf1gsYtEA KLVqbwNCMkpUhwN0nV295srmRqnIdNFdXQvGbfe4SNBxI7sSNaTUPJd8ok81UkHm7MBpBx6 juUESiBBpGDXCpc3U/fog== X-UI-Out-Filterresults: notjunk:1; V01:K0:dPZi8Yi2/7g=:unoGEDwmSn62HlZzE/1A6x 62TfHdl93ZnVfJa+i7M39aLuqWzLcBo6fEdWaEhU3x5BI3YXLyK/cHLqWX3gjdAcODSXw+G0C e00zUxCib3LpVh8AVopSz1EsCXnvJWXzQfkgGO9IbE+uRQB68nkG6VcZQF5SSx58MwrkHFud4 oQan7Ri8fjkseQJdBBMvGShiiODsmL5w4ovz0hH6U6tjynHPnaVv9NfRkW1G0OtLp9jk95vSs UMt4F1HcySTKF/476Pttoou1x15ibsxiJ71f0GVyWv+ydXrhHtYf84aoyTvVTj7fdqTceUx4s BXlmwp7y8dTkKwh2PD4eQzmJy1TLmxjs2ZQ5b9CF8t9fn0/8Tke1Rv67jk/8k7cLgnuNkfOsd Dtgj7yPiXW99AssBnNF8s7JF9tag9lWPI0Fb/KD4apIpwbYjak+WB+jNAzIPXE1vyKHUfsTln 356arJ9wr+O7e4RRr2Xtjf9f0aXFBcoeku8x0CWnyioYBcNWKnu2Py4NPoiXit8Zmue+XuYLT d6+PweF+voGxB1oZ2iDLgeszjda9HhxUS3qM6TBnek7HqgOBHKEQoZCROrCLza4r5+bLUUJaS U5xEihfakZTk12CX5jpObFCqVyewzeykBa+sXgIew6KdDyqMkSCFaD+vZdOC+4txKax+sQV0b ZQ9OKR5kcOKN38Is4ajFx9XwRK3qJwl34F25OLGf1tvbnUxRYvrPeiw7KYMYnv9OO9Voet9E1 siNOW1j4XbfFW3KWOR03Zet3Nghf6k41fbDG4up0CBBYpAnWn2BgoyQnz8zVHhA2vhQ4PtVH/ lr5/RoZ 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 12:10:09 +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 8b9ed3f1b132..ccc146bfd4c2 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -178,10 +178,9 @@ static int roles_init(struct policydb *p) int rc; struct role_datum *role; - rc = -ENOMEM; role = kzalloc(sizeof(*role), GFP_KERNEL); if (!role) - goto out; + return -ENOMEM; rc = -EINVAL; role->value = ++p->p_roles.nprim;