Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp53443ybg; Mon, 8 Jun 2020 16:13:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhRNqkvlcw1SYgkx51V0Zub2lO1l371pqOUkOpPgysr8qdh9FSCOo3qRwYtzDobjLzX9eE X-Received: by 2002:a05:6402:221b:: with SMTP id cq27mr23510342edb.302.1591658023701; Mon, 08 Jun 2020 16:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658023; cv=none; d=google.com; s=arc-20160816; b=xtkvVSJDB/URmC5ZkC8Y2pNuru2LEb3+nhZV/yhZ6Hf34752GVyZPCaj2tsA6zyS26 hYhJ/Mo4mXu4z4D7TTtdxq6/cFoGhtJIbu71e3l8qXEGKoFI041q47+Gd6DVKYJSOJfp VOaBbai5D8Yk9zC0SNodnwQRUEtsBYsL2vJ/nc689ff6KZ5awPvO3k1xj0/c2MUJtjDZ +vegQS9adVqX8hJwMahDONH1bt5UsPh7s74sOolw3LmdXkYSZ/NQGc6mSbYCK70gTkt7 bVtf5CEKxpxlL8BXLz8dkB3YbX8lJjsPktNWYNEvw1Cws8SumtvZ13sfY1aRtoc3lBhz r4hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wwRYJft5O8ix9vAl76BIB37hiqP/+BtHYWBPFEnFBRw=; b=N8gOfjoJGgoIOGkS1r4igPq/6IMcF2NqjFIXuKLIY4hjbY4yhyaExEA9Hkq7R/Tn7b 1J6hgB6I3Vb4Np18TwE9vtxCClGi0xdHYxNAmDA67bufbXCL/bNFCiyd89es/8y6xNCo 99dK82wrOaA8hPR9g7ubiHyQC23DsfTdydvEngEJ1tytmhdhpHB2JrspOzpfNClong86 VX8Bt7xg7chaOMn78BK9jLwZfsSVRTvNU6a26wd4IaJ5mwaed4ZGFGR9P1B6EDE1Pvam 5IQhB4CTQ+yv3CV9H5EmfFP2ZbtFS4p8cdyrtVzbuyz8Nl76W+XjwaTg9aOhOhABCEXI JqsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="L+te/j4e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si9116549eds.217.2020.06.08.16.13.18; Mon, 08 Jun 2020 16:13:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="L+te/j4e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728729AbgFHXKk (ORCPT + 99 others); Mon, 8 Jun 2020 19:10:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728421AbgFHXJ3 (ORCPT ); Mon, 8 Jun 2020 19:09:29 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC49B208A9; Mon, 8 Jun 2020 23:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657769; bh=wnNS99cHA6dlfP6h9le3Lc48er4P4aLxFt0UGZFEX7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L+te/j4eix78M0Yz5kAzOIhxQ/BsMHFavd2fOE01/TvDGTyCvtfim8MAwgSIWLoOQ 0ca3BBXGEBZwxGOgT4jy03ZmENPbtL2PL8rlBSblKwW3qFUzjGdftlGIElLsgHe/ri wJp9Wg//CIwXjJ1VkMhG8qhPt66cBTsfgxrmi33A= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wei Yongjun , Paul Moore , Sasha Levin , selinux@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 153/274] selinux: fix error return code in policydb_read() Date: Mon, 8 Jun 2020 19:04:06 -0400 Message-Id: <20200608230607.3361041-153-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Yongjun [ Upstream commit 4c09f8b6913a779ca0c70ea8058bf21537eebb3b ] Fix to return negative error code -ENOMEM from the kvcalloc() error handling case instead of 0, as done elsewhere in this function. Fixes: acdf52d97f82 ("selinux: convert to kvmalloc") Signed-off-by: Wei Yongjun Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- security/selinux/ss/policydb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index c21b922e5ebe..1a4f74e7a267 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -2504,6 +2504,7 @@ int policydb_read(struct policydb *p, void *fp) if (rc) goto bad; + rc = -ENOMEM; p->type_attr_map_array = kvcalloc(p->p_types.nprim, sizeof(*p->type_attr_map_array), GFP_KERNEL); -- 2.25.1