From patchwork Sun Jan 15 15:30:06 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: 9517549 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 57D8A601DA for ; Sun, 15 Jan 2017 15:30:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48CF428387 for ; Sun, 15 Jan 2017 15:30:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AD75283AC; Sun, 15 Jan 2017 15:30:27 +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 DF2A328387 for ; Sun, 15 Jan 2017 15:30:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751176AbdAOPaZ (ORCPT ); Sun, 15 Jan 2017 10:30:25 -0500 Received: from mout.web.de ([212.227.15.4]:62391 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbdAOPaY (ORCPT ); Sun, 15 Jan 2017 10:30:24 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M4qcP-1ceWiq09uf-00yzM7; Sun, 15 Jan 2017 16:30:09 +0100 Subject: [PATCH 30/46] selinux: Return directly after a failed kzalloc() in role_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:30:06 +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:LU+scK0xtG/zBAX1pX7pFEItR46RrjwW9KgjAirrtfr943RVidR UDnU+QHTJnYdz19t667v5dpsUgn3w97oFsF5lsH2uMppZYj2k8lK+iNpqj6IZxGXmQFc3t0 T1oCc2ggUESffntGdOFKISnmEGdTy0gULAAddztE5OLxTh8Fuxy9rKJilKPO4xqeLcnw/zv vau/032oWQNMH0ZQLvPgA== X-UI-Out-Filterresults: notjunk:1; V01:K0:lDFc0YPxk4c=:rivQ1e9mzDdR6n1/5019EB SawrUk5nBCF+TySMwR5iBmujdI+lOo01olz8KjlvGkqxIopih5Xo7khdSLacqC6FR3T3VgZ1U YBaGOLOad9Czf0jFgOtP6zeHzm412b2pjhORKWrhACZWpXhWY/UfdIQ7sAjAp58rDietKsz8r VLw2F3IbxYbVfq1I7FdMhE5FCcELDBmkRu0I8JoC1IoVj5yXZn4X4z2rzJ3ybKiO7uban7CwD nOhNWBgh9AEZDjqP1Ovfo7PmEhGVD6ddB9BtJ4PZ6cijscmsFnG6l5ed8puQpnl+FG/j6CkXA tox+rCwCFGQPCnzbpMogtYbqY+q+2W3mcp7msd33Gz8p7x2is+PAdiUxan/1z7ic9QZ+ZJzl1 VVOr9GgrS5E+sbqb+Lg8malR8YeoLoNCuHNpvbqMw0ugZ/RzjVQpRaBrNlwU5j+T9xip1M02A 6cayu6ZTgqeba7mzFtmtEumswJwFvvZgCXxBI81cUu71/3bsyn8YwEEovfEgvCmoPVQD23nv7 69NKpCecgTc9sbAK6zJHbFiattDiMmR4P/33fj/bFhz1SOUXIukABc8CxXrqOhP8rJz7kudwg yfzk/84hEOfalDI2mnd/Yoq1IRFSr9hOPj9ll6Wnaw7ygAOivMSgGSJimRTrr2sAAFtA8p/0g uQu8SakcpMWFrdKGCOI4binxQ1tE0G/DWnT3rncanJn8ysPyFvl5QaDe3CiEAMI8LNXAZjDAf Fmm4LCJAXiL59iIbjQuQCHyhTrbSyWrXIPryP9takkqOjAjFxKHeJ3okxNQWHt/jI2LhkWsXl XMkIwiy 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:20:25 +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 662139365449..34b670227c4d 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1410,10 +1410,9 @@ static int role_read(struct policydb *p, struct hashtab *h, void *fp) __le32 buf[3]; u32 len; - rc = -ENOMEM; role = kzalloc(sizeof(*role), GFP_KERNEL); if (!role) - goto bad; + return -ENOMEM; if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) to_read = 3;