Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4980763pxv; Tue, 27 Jul 2021 23:31:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFiab/1T1FvujACngZ3JrAo6lnckGvoiYD3f86DeQMgHc08/PYygua7/NGDClsBbKM1NkC X-Received: by 2002:a92:c0cc:: with SMTP id t12mr19254527ilf.47.1627453862848; Tue, 27 Jul 2021 23:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627453862; cv=none; d=google.com; s=arc-20160816; b=Suv2/1UNVduUrEv52ehoT1mjn22+G/tCtaGKPG3dKbJHHFmuQTuSUF9IuNoLTC5bt/ fCErvBDS5IsDUZHMa5X7TYHktMN9BJNrOl1leRo8VeNR3Oz3Du7RsvhN2YwIVaAE52Rt EXntcuRPWYdL2Qt3akGz2w0QnhkcVRsQtVCbg0GcRmQBVE4oVwQgvS0Z4q27smKe28ex M7MezC772sG/aMJz2nPMsvYE+186n2DkIf+19HOBlH0e0XAJxEnewtKonE28wbUCwbor cSvNNgK3OIe6wCsztO4RFiNmG8g+SP2Y812Etm0yCUsQxktDMkpdW7RCNcbRGHMT6nZW tx+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=y9h406rcm9LnvAIMXV7vrpHUxxTEOa2z1ZYwFa1I4ew=; b=AEzRRLMYof96HiWYtL9hhWHgW/y6X+vh//kLhSte+5O7niAqeowSUUgITxMeCGEyOP 6PQ3C1P8DDTPIs/lkr37unJSd0CxiMrUFptUOwUxnT0e0qmL2D/u3EpTykC2gUt1p1QB 78cYn/RoYYwat8O3/eza7g6+Srn4NpACxonnxBluUfXaPh9uKA+PSYMfJ0/KFaB1UDN/ d4I83v6fYV+BWVU8T7uTehfPnND25WptYH4Prne+45bW0yY2KYL3j4XYK41gcfgdpEKM oaBbUc/XxzBgU1XB5Fi1Vw8SzSf0JZabkq8Hf61p96RFSogKq9HvMbWepDgBi2ti7kRd jb4Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si5312592ild.148.2021.07.27.23.30.50; Tue, 27 Jul 2021 23:31:02 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233670AbhG1GaJ (ORCPT + 99 others); Wed, 28 Jul 2021 02:30:09 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:12322 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231484AbhG1GaJ (ORCPT ); Wed, 28 Jul 2021 02:30:09 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GZNv63X11z801B; Wed, 28 Jul 2021 14:25:22 +0800 (CST) Received: from dggpeml500023.china.huawei.com (7.185.36.114) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 28 Jul 2021 14:30:05 +0800 Received: from ubuntu1804.huawei.com (10.67.174.58) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 28 Jul 2021 14:30:05 +0800 From: Xiu Jianfeng To: , , CC: , , Subject: [PATCH -next] selinux: correct the return value when loads initial sids Date: Wed, 28 Jul 2021 14:31:10 +0800 Message-ID: <20210728063110.3652-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It should not return 0 when SID 0 is assigned to isids. This patch fixes it. Fixes: e3e0b582c321a ("selinux: remove unused initial SIDs and improve handling") Signed-off-by: Xiu Jianfeng --- 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 defc5ef35c66..ad1183e18ce0 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -884,6 +884,7 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s) if (sid == SECSID_NULL) { pr_err("SELinux: SID 0 was assigned a context.\n"); + rc = -EINVAL; sidtab_destroy(s); goto out; } -- 2.17.1