diff options
author | Xiu Jianfeng <xiujianfeng@huawei.com> | 2021-07-29 11:16:44 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-08-12 13:22:16 +0200 |
commit | f4984f60acc79bf4f626f42a152e6148d0fa4601 (patch) | |
tree | cf0ebc10941117b7c7530c8954b82d5031f0800d /security | |
parent | 100f8396d15480435b889e7ac571da3303b6b12e (diff) | |
download | linux-stable-f4984f60acc79bf4f626f42a152e6148d0fa4601.tar.gz linux-stable-f4984f60acc79bf4f626f42a152e6148d0fa4601.tar.bz2 linux-stable-f4984f60acc79bf4f626f42a152e6148d0fa4601.zip |
selinux: correct the return value when loads initial sids
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 <xiujianfeng@huawei.com>
[PM: remove changelog from description]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/ss/policydb.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 9fccf417006b..6a04de21343f 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -874,7 +874,7 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s) 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 *p, struct sidtab *s) 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 *p, struct sidtab *s) 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) |