Skip to content

Commit 0b53abf

Browse files
committed
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
2 parents 6209049 + 4c15608 commit 0b53abf

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

security/selinux/ss/policydb.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s)
874874
rc = sidtab_init(s);
875875
if (rc) {
876876
pr_err("SELinux: out of memory on SID table init\n");
877-
goto out;
877+
return rc;
878878
}
879879

880880
head = p->ocontexts[OCON_ISID];
@@ -885,7 +885,7 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s)
885885
if (sid == SECSID_NULL) {
886886
pr_err("SELinux: SID 0 was assigned a context.\n");
887887
sidtab_destroy(s);
888-
goto out;
888+
return -EINVAL;
889889
}
890890

891891
/* Ignore initial SIDs unused by this kernel. */
@@ -897,12 +897,10 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s)
897897
pr_err("SELinux: unable to load initial SID %s.\n",
898898
name);
899899
sidtab_destroy(s);
900-
goto out;
900+
return rc;
901901
}
902902
}
903-
rc = 0;
904-
out:
905-
return rc;
903+
return 0;
906904
}
907905

908906
int policydb_class_isvalid(struct policydb *p, unsigned int class)

0 commit comments

Comments
 (0)