From patchwork Sun Jan 15 15:25:01 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: 9517529 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 BF511607D4 for ; Sun, 15 Jan 2017 15:25:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B11CA2849F for ; Sun, 15 Jan 2017 15:25:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A21C4284A1; Sun, 15 Jan 2017 15:25:17 +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 4BBBD2849F for ; Sun, 15 Jan 2017 15:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751216AbdAOPZQ (ORCPT ); Sun, 15 Jan 2017 10:25:16 -0500 Received: from mout.web.de ([212.227.15.14]:51269 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbdAOPZP (ORCPT ); Sun, 15 Jan 2017 10:25:15 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MF7Nb-1cCabE1GGZ-00GGaT; Sun, 15 Jan 2017 16:25:03 +0100 Subject: [PATCH 25/46] selinux: Return directly after a failed kzalloc() in sens_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: <8f253493-ae7f-ca02-a6f3-333e896eeb7d@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:25:01 +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:yEFit9/QjVdvBwffk642eh+lloBiiXKtKHaKMV7OAoAG/0VYLFV 5a5tR4Ck9hcFsRrj7n3J1L9eXb3xlvHlbE1uGqK0FyKQX7/rKF/EePpBrImcwE3auwar1qU H/BO/AFWJVYU6TXSc+CsgyHtwAZESQh9y/NtztwK/7bCKpVojdYHOkeY8ZWGvj4ksNWT1rA moQaLehx0MZKWQstfA8ag== X-UI-Out-Filterresults: notjunk:1; V01:K0:+AEtjPqOJUA=:qQyeQepK8NZJ531WwUtzzx 5hgfpWsYQNbIAPQuscCMJrPZwCWXu5kptUNAHYlkFL9l3I/rDDcpbJffS9IPdRudWDGM2nBYt ad2RA+vrVDb0uJb8FPUuIV365aqfAXN4HXVRuL3LMqKkKfXlPb09Ja/kASzv1NogZ2y7j2aid lINDYkSuuc5bGER7xe/GOO07nSJ/v2mHLCI3HzemiqxE6VWeaTPLH84naY1VYSf2q708tX2bM Ei+uwgBFBlQkPJh2GZvxzjfdIS/Y4LN15jTrjmfq6F2pWSb85KaOjdMMPVATDSZFUbX2/W4Oh vga+73WbVxDpsOerG28215oHyH6UN6PG268sNQWQrOjEOtAA+fSXcEx2JQpB5Nt3R2ug+okf2 KdjCMoy31LWIODa3EAIbIhT4ZB+I36me8IWP8mW1MD7hcOWnEg6/9UvJ4oJ67Txk7ieIDIFZS DgSB6Yb/QsX9s+i4ltR3Ec0LE/O0Z5Fu+mKBo6ex8PpiweVrCCDnbyDcP43xOKYLcOcPNeT31 HYdDEp03oTAZpaNyEGR6ZkjNLnMXfBZhDpq3X38Lj9Bf0zMqLI1VKryNhBPlZSqo//zlEfVeY 3b9vBkAARYvFReVaA28Baw+LcDBxmKPyLOPxvjosNx3x5oOopwkgAChj7+9qWVvkZKd5wQwIj IBDMLk7zTylcG7DehKHrOr0eP0oYuSH1VV9oQRFD/Whv3McJN2LDI8rJi3+7qut37TuSfvO7t 7z6VB3McgvBJby1LBENgd1ycTRN9zq8IZq25mVgM6mdbjIz2Ouw0RBAapP7QEED8R/yRl6A9n mu0pVg8 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:42:02 +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 eb898dcbe502..5caa1fa5ea80 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1593,10 +1593,9 @@ static int sens_read(struct policydb *p, struct hashtab *h, void *fp) __le32 buf[2]; u32 len; - rc = -ENOMEM; levdatum = kzalloc(sizeof(*levdatum), GFP_ATOMIC); if (!levdatum) - goto bad; + return -ENOMEM; rc = next_entry(buf, fp, sizeof buf); if (rc)