From patchwork Sun Jan 15 15:28: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: 9517541 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 C5570601DA for ; Sun, 15 Jan 2017 15:28:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7BE7283AC for ; Sun, 15 Jan 2017 15:28:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB21C284A0; Sun, 15 Jan 2017 15:28:22 +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 4FB7A28387 for ; Sun, 15 Jan 2017 15:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751204AbdAOP2T (ORCPT ); Sun, 15 Jan 2017 10:28:19 -0500 Received: from mout.web.de ([212.227.15.4]:58557 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751129AbdAOP2S (ORCPT ); Sun, 15 Jan 2017 10:28:18 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lzs0p-1cWJIE2kDb-0153qd; Sun, 15 Jan 2017 16:28:05 +0100 Subject: [PATCH 28/46] selinux: Return directly after a failed kzalloc() in user_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: <3582dff5-b96a-dde7-2d1c-bca7ab4aeb0e@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:28: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:wTmuqJEi/tmbIoJ01W1f0A0kNpHgyLb3zsic4qWeX8hXOmQYeAe 8yNMRCXUlBvsDJt5a3KiCUpDCXSxOTzDKvTUfkr0xtHVyBedvMbyEJmK0JvtjzBUDTzfuls PDSWLDdXdn9yUo8qb25aBFXPT30cO1jOPJM+ULThzF4E3KQJYQLWp77UjcXPDq/Y9cdsek+ DEC5iAuh1GnYLhiPPfUEw== X-UI-Out-Filterresults: notjunk:1; V01:K0:w4mEGAgYef8=:lS7ov1QO+rbB9GOqAePWri Oxfw1RSiB8wOOdu3PY3m2fV2rTJGi2imb3+ZOmpFODGK7UhrzaSv2JTUjRh/DfhF7Epm3qrtL 3kc1XUUiJE+j6LK2bF56yOO674Ou5huBYznoz2gk4vUgFw1h0P+rb3DqfdyhfWYWurVw/Ka8Q m+1DJOd7WHGPkbrWuNnkwo3CUPv+MkDIq+1RBAvqgoOl9WUlqSEq30Ks1vPP4zBr09tNLAhC5 n/l2r+VytAfAiijH6w+IIzIBK0soSc+J3zqIVFRPYgNgMEpG4fLgv3/0jc/OyJvi1H39oGYkB 5QDX9HjqXfYRY5AEJEpBmf/C0jop1l/JPUP0B0v1BvwkPt0kmwh/Naa3AGZwTndBuITtX8xrH kQJMuBJcj1x4ImHDlE17yyc5sjVkB1ngTejUybMvfaN2qg59P/ctoMa7jbf1nzPAEcHvaJN5B R2wKCdU9q9I6/dygKO/7m1eHVK4rDBRakky0bXWJz1AcITOavT6E/8egzjmV/+j/FGKCGkwNe G8qdTyfDdcB7yvXnEKwUCCP1/iVsl63I8aV+WEgHvGohzkt0EYwSPNTs5tblNeX4RHdaRK7A2 dD4nUmBhIzPpGBZnwM8z2OGrmM4YP5f4W6J70ncIw8hGvNalfkY/pPwjOTacd/y7/2iwaOB+f DjIqEgGKoAxyiz7v0tkxHyY4+gBlx4srRyLB/lRQYFW55wCNdJtynwxmv+o1oGmiqubKArGG5 u2ldHiFWUe7+pZOn2hxijMlSgC4AaYFnEkZMr/xx0I+FtdwyWv1/D67/6VHY2UZeQzaDf3ZQv ZjguXFf 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:08:22 +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 3e43556e67b8..1c046d39e2a7 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1542,10 +1542,9 @@ static int user_read(struct policydb *p, struct hashtab *h, void *fp) __le32 buf[3]; u32 len; - rc = -ENOMEM; usrdatum = kzalloc(sizeof(*usrdatum), GFP_KERNEL); if (!usrdatum) - goto bad; + return -ENOMEM; if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) to_read = 3;