Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5359268pxv; Wed, 28 Jul 2021 08:57:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBhYet5MWw9UYYAdnKjy1FbTAJIO/jUErIrbthqOxbJOOb+SIsiBVKQEKk024SKymRM7+m X-Received: by 2002:a92:190f:: with SMTP id 15mr342004ilz.45.1627487862155; Wed, 28 Jul 2021 08:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627487862; cv=none; d=google.com; s=arc-20160816; b=a7rioci/kECfBIwBda8NdtZHyKTzFjS7xngjiDLcnukIptMEwdTXcVebrnrEbMvRCQ LQ5uoWGFYq47w5b0H7EjNz+b26eEpoLnxp9Otk13gtqFD4IqEMtuHGK5KG9L0G34h15i 7fhBig1GyHZW3TgzCM//CGKb1cE2FNH2/Vx4svNyNRmH3RaYluWVq8jX/vCOikr52G2D yoJexJoPsExjEp7gg7LP5QebraogOdllpT0QDlRSgypOSTnF+4YrBM7R08TpqkM2N9L1 FSceLUIQdHrpggM+HUD+kiaDqx+qaOihdHZDyZdE1Ldq8X7R4EepUiEnb66R2KKUBNKu 4A5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/KJBia7ATQ1PTUNjJu6JBkn1Mi7yqgxyK+/WDg/bTwg=; b=gyHk8vWye4xBd3vEvNphcTYJpXJzJ3mYl1Y5hPgj5GHwPCxXEEwA2GTr6JM/oinhrR jTLy5idnAGvA+c+1jPKf/Ojox6RyR3ti0ks45bNOkwuDyEX+RA0xCEimHR75I4T+YICD MF0xWXgu4E1NgfhTTX+lCbUygc75GHa7q4c3/jRckYPGwoko9NXxKpODPrA3h/wE+CtQ VSOHTbbzDbg2nT6zWK2PiRJ1IY9FEMOJAj7qxB+yWNu816YlfiiEI6yyJCXqZ9YbE6oI UpHA8hhS8/en9peVLBA6+OhmwMDZn8mCQDi61+2+++HncqVdbcA7MaDqGmIDJd700+tV +JuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=w70ktT0s; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si297429ion.28.2021.07.28.08.57.30; Wed, 28 Jul 2021 08:57:42 -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=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=w70ktT0s; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237178AbhG1P4s (ORCPT + 99 others); Wed, 28 Jul 2021 11:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237142AbhG1P4r (ORCPT ); Wed, 28 Jul 2021 11:56:47 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B4BFC061757 for ; Wed, 28 Jul 2021 08:56:45 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id j2so3867068edp.11 for ; Wed, 28 Jul 2021 08:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/KJBia7ATQ1PTUNjJu6JBkn1Mi7yqgxyK+/WDg/bTwg=; b=w70ktT0sUm4x5/f26NtVnnrUk4m04hSQhSs4kv5uGRm+4aZ3jc+xsnXtcdLBLG4NFd 4ffVZN6ro+DEuvceEZPdZ3gfhQdGlEYgFk+OWPUYCi3H2S88nBvByOu2uCBxuK1I9A8f cu8U/dG3Oul2ze2IIG2AVchUM771Ffb14PHfrIQSZPTVIJyXgNeCmPcvG3Ezp6dwnCfg zT6cw/Nh6Si03kHIVK0vRkOspja7ykHPRO5n1OVpQqsjdbaqLXGSVXXbxUuYv6mdhax5 VNzsBnP/7LOB2OzRDm7+zS3onc945fAzihKL5zZhsBfOcQwjc5Go8qZ/ZGN8RfBBGUSI mD5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/KJBia7ATQ1PTUNjJu6JBkn1Mi7yqgxyK+/WDg/bTwg=; b=DVyWAnRcbbs6Co6CM7D8XC41xDwH865M/sPYP3twnccTUiGhewjNtN7Tff189EJm3v +9cJOBVn0Z948KAUp0GP8SWtREL6L4iD67E9MGkcja74oMkxiZieUeqJCXB2t6lKHKgN XHwMol6AqIibEi+jgYJzXb2Ze7VpzqgFwfcqMq2Bvg3ZdVaAt5JAl0NX/TIiqKXl/MBt xsps71br9ZZ4eUZy4V1tdephXnWYk+nUlfqgiLKxBkAZa2kF9RIOuXej2Ze/QVi6vDGH BT0khNg7DsGLegwgwIaYxH+zSLxY2faEqR6w1BMRiPDcQFYvp2W5DGpB/7NEQQCTmxaQ nvnw== X-Gm-Message-State: AOAM533cYLaUsh6AhdLHCHjty1eM3jjmru8YwbXOJB/028/s/SbIfGT1 pBgrXNLKI+5Wbjc31NscAFdK0jjWoQ45dCcvNfkI X-Received: by 2002:aa7:c792:: with SMTP id n18mr581349eds.269.1627487803897; Wed, 28 Jul 2021 08:56:43 -0700 (PDT) MIME-Version: 1.0 References: <20210728063110.3652-1-xiujianfeng@huawei.com> In-Reply-To: <20210728063110.3652-1-xiujianfeng@huawei.com> From: Paul Moore Date: Wed, 28 Jul 2021 11:56:32 -0400 Message-ID: Subject: Re: [PATCH -next] selinux: correct the return value when loads initial sids To: Xiu Jianfeng Cc: Stephen Smalley , Eric Paris , selinux@vger.kernel.org, linux-kernel@vger.kernel.org, wangweiyang2@huawei.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 2:30 AM Xiu Jianfeng wrote: > > 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; > } Hi Xiu Jianfeng, Thanks for the patch, but since you are fixing the error handling in policydb_load_isids(), would you mind respinning this patch to get rid of the "out" label and just have all of the associated callers return directly instead? I generally dislike jump targets that do nothing else other than return a value; those 'goto X;' statements can easily be converted into 'return Y;' statements. Thanks. -- paul moore www.paul-moore.com