From patchwork Sun Jan 15 15:34: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: 9517567 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 1AF6A601DA for ; Sun, 15 Jan 2017 15:34:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DB3627E3E for ; Sun, 15 Jan 2017 15:34:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0061728387; Sun, 15 Jan 2017 15:34:31 +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 B3F9127E3E for ; Sun, 15 Jan 2017 15:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751262AbdAOPeS (ORCPT ); Sun, 15 Jan 2017 10:34:18 -0500 Received: from mout.web.de ([212.227.15.14]:63075 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751129AbdAOPeR (ORCPT ); Sun, 15 Jan 2017 10:34:17 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MeSLv-1c4uwd1li3-00QCWO; Sun, 15 Jan 2017 16:34:04 +0100 Subject: [PATCH 34/46] selinux: Return directly after a failed kzalloc() in common_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:34: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:NRaxL8qW4/tGl4A2DzaeSLVd4KD9OuP24HptuqA1iZVJdgP8XgE ikoCgboVj5XI3uMmL+6VBGsikvMLgbMTIsW4KyWKGqPE1EypCyYO6iNwKnOD4nWTv0LV+p8 N9167ZjmMJ4pTH7lp0mNS2NEZ9JZi/5Tskp8OG1zWBOUCtasFh+ypj8yeGPSZBTqT9o5YdO VIhQuWlqwNp5YwelPKtMg== X-UI-Out-Filterresults: notjunk:1; V01:K0:2o+EBcuaZWw=:AWEtHp4v3bYHV0RUxqXQdX dLtUNxsePoBqSHcqKLnOWg/huy2Go2PazwkgTM4+TH+fswBxHOLLKi6o9sBibuYT2Czi61VDz tpWFuI4JIt7Z3b+6WYGoEa1zDgqblCSA+a6TI2nehRwldjhzkAxv1lW1iwNtiYF8nS+KSIn37 HIVucKjIu+2gA4av+5yPico4tURbyqBPzFP4yHh8Ujl6Yl4hkRW3/j+hZXK0BbD0LatEOY522 gO1wwylKyRApVoSQ2sdZveuQm30WcapbfCtqdpesT/Gv3RHfLzeHJL4d0H7L/kWcOdaCxwF9f a17gZoAMBc5loTYFHghKqcEydhbfYSlWW1FLmuzWbsBJqPA25huKpxLXqT+A8m2dSoVP3ZEmW QRG+iOVEAFhUXOVVSbMyxStkRiropYjDK0HcYmd1fuord9g2kB/zixWL8VSpEJeW+EJJbHvMf AN4hv4FGMSohXX5ekx5feJo1CbrOBZEiBJGrfgyVhmIUPw5IsNgE6WfnGUCy2SEeuSiax4v73 PiT/WJP5Gjg3Bil8b9dYpT3q52CSAAHkNcEA2xd9rvH6PQ8lU57KK9j7ECbvqaOrfY4M0rUZV +O9AZ1itl7R/45RNCoxEl0DMhLnWQidTJWbDeSw9za/COxkqZfYdm91YT4Akr7mqwYonewly7 mJi77PhtKzv1WT6M+53UQ8RjAr2d5twpQcRnIDytz0Gsa1UbW8g56u7SPU8qrbxzObxiERHfV noU/xt6oHTvfDD6UyPD6+tOZRXQdotT7jMrw3zXBih2r0/Er31spFOY7tPWEAdb8MqvmZDg7R IOlT0Ub 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 11:15:19 +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 9035e5329ceb..551685283399 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1150,10 +1150,9 @@ static int common_read(struct policydb *p, struct hashtab *h, void *fp) u32 len, nel; int i, rc; - rc = -ENOMEM; comdatum = kzalloc(sizeof(*comdatum), GFP_KERNEL); if (!comdatum) - goto bad; + return -ENOMEM; rc = next_entry(buf, fp, sizeof buf); if (rc)