From patchwork Sun Jan 15 15:29:04 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: 9517545 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 8ECE7601DA for ; Sun, 15 Jan 2017 15:29:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81AD028387 for ; Sun, 15 Jan 2017 15:29:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 742AB283AC; Sun, 15 Jan 2017 15:29: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 1857C28387 for ; Sun, 15 Jan 2017 15:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751231AbdAOP3W (ORCPT ); Sun, 15 Jan 2017 10:29:22 -0500 Received: from mout.web.de ([212.227.17.11]:56052 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbdAOP3V (ORCPT ); Sun, 15 Jan 2017 10:29:21 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LbrZ2-1cuB0x25Zc-00jIHU; Sun, 15 Jan 2017 16:29:08 +0100 Subject: [PATCH 29/46] selinux: Return directly after a failed kzalloc() in type_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: <3719abdd-0551-c567-31f0-94693a83d683@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:29:04 +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:Qtm3/3uesDzrRI5zCvqrx/DIcwNs8LzZ93NYFt4vYnWWyyEaCdN 36OpxemY40NkoU4Y6lYaVeZ05SOfizNPo13emlkpsiOJmP4DSz9MxXv3KL6endlsKz1L2sv L6OdfLTKLYwGAS8uwpMpqNcSn3BEcIm7vqLMdWQaq+Kov5nkSDy9RlHnLPh2z7VWc1ahNyA mQ+ZyewdSPCvRe3Vpsk7Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ON0RFZ/gNR0=:BL71DxXWxT8lZqn59sXYQG Q8OO31tKK54Ptwtrt0gD3Zb/jEKVgjxqrzowiqmjK9FGN3sXug6TOy4vIsNW2LC7aNqZr9wbH Bm8GCYEgSvAVp68DMvIMtYtVKfrjr/+5KprBPV3RDTtG7HWgdRO6KiKxoxTbS1lDAD+uQXkpk kq3abccqw+06ssGGZF3PqjzJZ6ONPzwvAFvvMXjkDRWiiw6BNd7bMWczdxIqy07RbrhMqIpbt xJO08one6RZYDrYln3YG2Pbd8VbF0KywwkhCZRlZbCTMLCx/zbfi8Q+asosvMym0OzaGKGeem Nz1rH7Uf68w0sOlWP3ps9OfaR421TH6ufcuGY6FcKGXvu5KSWzyOQB+L6Thj2GwqubHq7ZwNE dfxUwL6cpxXK1Crf0aBl08H/H5fLVuwZOw/dJIvqBGCxc8+jzetZ64wFvkect4HabSLeGoU1y bIL2BM7yGGyArS9MK53BdgM+fcWzvgZG2Uffhk4NHP/p1yHCcCPbeJlYiI5+9sVgGVmZK9jG8 iiOnBOX5jzG9lRJKoCU/CGxM00wlLXElaieNQ2NdOJqlfvXDMnE2HJjaB1MbKjUmojuZkWUCM D44WNApfRk7Sry5m7mY3z+c578Tif2OjJYkOfnIp9G7H+SbPZ+xOPg9UUA/NLKvSivhw3PG/s xpVNM4ubmNP9tVcKEK6vWPyhf/0d0o6SY1jJX6EZ5Cen0OVpKwk+FUPJzu5Z9qBxDD2zy7xXe CSIOHwAu9wCNDRDlFsTZS4rBAMxZBzYhf7wD0Nj4ZRMeQmhmD6ckHJCrW6QL44kPQnQ2RLBqD wz4/k8l 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 22:15:54 +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 1c046d39e2a7..662139365449 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1467,10 +1467,9 @@ static int type_read(struct policydb *p, struct hashtab *h, void *fp) __le32 buf[4]; u32 len; - rc = -ENOMEM; typdatum = kzalloc(sizeof(*typdatum), GFP_KERNEL); if (!typdatum) - goto bad; + return -ENOMEM; if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) to_read = 4;