Skip to content

Commit

Permalink
Merge tag 'selinux-pr-20210805' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
Linus Torvalds committed Aug 5, 2021
2 parents 6209049 + 4c15608 commit 0b53abf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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. */
Expand All @@ -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)
Expand Down

0 comments on commit 0b53abf

Please sign in to comment.