Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3767827pxt; Tue, 10 Aug 2021 10:51:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGAlErtSOlNbmZPPBSTabKAOpqLkCkXcOTDqBNyii4FzuAo3xKt6nvpXOzLHjVfpoHq9TW X-Received: by 2002:a17:906:c251:: with SMTP id bl17mr29040169ejb.219.1628617913238; Tue, 10 Aug 2021 10:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628617913; cv=none; d=google.com; s=arc-20160816; b=ag8bTRymDqsID1bPRNiqjw1GQOTM8VtWZdeRBThCu9gKZ16lIeQyHbi768KBl/9NzT EJRLIvsNzZz1dutrzmn2gHwp3X2PTZ2uByBBpG2pkm8fFcUn9txY3v/l+9Yww9JN3EG6 pfCtug26nil4ZEIVCwIR56LdZUvrJ6ZzcfwbKNFVZxJLKC2MsVBiJAoV52X2B5n/FwNz BIT4oosZ3+sylc88L8kP3zP5MsvhFkvbTBaHmanVx+8B7AjAZUl0ZIRTZfG3y/x8I72Y 687jpAPeyXA6FSseKyHl0m6FWz7W25y1Xov8x0FmPc7/Y79ePbUNQJj8H9KpdY4NPYFy Gg+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=93ci8UVLaTrBoBLOe5sVD85pc0+PcSp3QSPyOa6R8og=; b=QUNZKklsapJYBclnciIn4kvGEVjvJF84OGfPxPd0ZD0PoIC6IPUT4HzbwJ7ZVOd2QM fqFQt2YbBs0yblnXHyP/eqtRh9qKdtO+XX7y0A2Fv0dNjU2n1n1nUr8Zju4M96ViCHLV LiWMmZuwTQeb6eAY6nZdNB3AiL1AjhopCeWUUyBVNC7Gh4wLfuFGXd0p8wRw27vQ2GY7 yliWp1Db69e4XsYsv+tgSBfgVmnkNfxMmVG87fA7zZyEqM/BJSTxLOyABBvMsRfMTNIj zogvDhjC4lqcahy46h0sRxHPcbpFFxxJWIvPLLT+D+ZtIwiFUQ/Zv83+AkktXtEYd6Fg 1aJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ULR5Qjnv; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr7si20564999ejc.114.2021.08.10.10.51.29; Tue, 10 Aug 2021 10:51:53 -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=@linuxfoundation.org header.s=korg header.b=ULR5Qjnv; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236135AbhHJRtL (ORCPT + 99 others); Tue, 10 Aug 2021 13:49:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:41108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236122AbhHJRqf (ORCPT ); Tue, 10 Aug 2021 13:46:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 232F5610E9; Tue, 10 Aug 2021 17:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628617238; bh=bswYOrY3+n4a6Hq+ZLvqJTXJghVf156L11jaxz7vkMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ULR5Qjnv7/SlTsUDWNUp5rZq8YSrQMq59tUFfEqUs9D/eR/d8Nj4M+F4ILWhcFvhK YAjd+5lKqxWmUv9sOEW8p5E2sx/yJ2B6DhqoGdovPQ+UQpB9OJYgdFepmlcV8mmwdd jjtjf0jZz1Y4Hrfu9Ixlh0ob4tiNDemk/uN+XULc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiu Jianfeng , Paul Moore Subject: [PATCH 5.10 105/135] selinux: correct the return value when loads initial sids Date: Tue, 10 Aug 2021 19:30:39 +0200 Message-Id: <20210810172959.333458172@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810172955.660225700@linuxfoundation.org> References: <20210810172955.660225700@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiu Jianfeng commit 4c156084daa8ee70978e4b150b5eb5fc7b1f15be upstream. It should not return 0 when SID 0 is assigned to isids. This patch fixes it. Cc: stable@vger.kernel.org Fixes: e3e0b582c321a ("selinux: remove unused initial SIDs and improve handling") Signed-off-by: Xiu Jianfeng [PM: remove changelog from description] Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- security/selinux/ss/policydb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -874,7 +874,7 @@ int policydb_load_isids(struct policydb rc = sidtab_init(s); if (rc) { pr_err("SELinux: out of memory on SID table init\n"); - goto out; + return rc; } head = p->ocontexts[OCON_ISID]; @@ -885,7 +885,7 @@ int policydb_load_isids(struct policydb if (sid == SECSID_NULL) { pr_err("SELinux: SID 0 was assigned a context.\n"); sidtab_destroy(s); - goto out; + return -EINVAL; } /* Ignore initial SIDs unused by this kernel. */ @@ -897,12 +897,10 @@ int policydb_load_isids(struct policydb pr_err("SELinux: unable to load initial SID %s.\n", name); sidtab_destroy(s); - goto out; + return rc; } } - rc = 0; -out: - return rc; + return 0; } int policydb_class_isvalid(struct policydb *p, unsigned int class)