diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-08-05 21:06:31 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-08-05 21:06:31 +0200 |
commit | 0b53abfc5f66449d42fb1738c1c191e29e3be2e4 (patch) | |
tree | 127a2c9e4256769551dc454bf8d6dcf701778957 /security | |
parent | Merge branch 'for-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ebi... (diff) | |
parent | selinux: correct the return value when loads initial sids (diff) | |
download | linux-0b53abfc5f66449d42fb1738c1c191e29e3be2e4.tar.xz linux-0b53abfc5f66449d42fb1738c1c191e29e3be2e4.zip |
Merge tag 'selinux-pr-20210805' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore:
"One small SELinux fix for a problem where an error code was not being
propagated back up to userspace when a bogus SELinux policy is loaded
into the kernel"
* tag 'selinux-pr-20210805' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
selinux: correct the return value when loads initial sids
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 defc5ef35c66..0ae1b718194a 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) |