Skip to content

Commit

Permalink
Merge tag 'selinux-pr-20181115' 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 fixes from Paul Moore:
 "Two small SELinux fixes for v4.20.

  Ondrej's patch adds a check on user input, and my patch ensures we
  don't look past the end of a buffer.

  Both patches are quite small and pass the selinux-testsuite"

* tag 'selinux-pr-20181115' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
  selinux: fix non-MLS handling in mls_context_to_sid()
  selinux: check length properly in SCTP bind hook
  • Loading branch information
torvalds committed Nov 15, 2018
2 parents 282fd2a + 877181a commit da5322e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -5318,6 +5318,9 @@ static int selinux_sctp_bind_connect(struct sock *sk, int optname,
addr_buf = address;

while (walk_size < addrlen) {
if (walk_size + sizeof(sa_family_t) > addrlen)
return -EINVAL;

addr = addr_buf;
switch (addr->sa_family) {
case AF_UNSPEC:
Expand Down
10 changes: 7 additions & 3 deletions security/selinux/ss/mls.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,13 @@ int mls_context_to_sid(struct policydb *pol,
char *rangep[2];

if (!pol->mls_enabled) {
if ((def_sid != SECSID_NULL && oldc) || (*scontext) == '\0')
return 0;
return -EINVAL;
/*
* With no MLS, only return -EINVAL if there is a MLS field
* and it did not come from an xattr.
*/
if (oldc && def_sid == SECSID_NULL)
return -EINVAL;
return 0;
}

/*
Expand Down

0 comments on commit da5322e

Please sign in to comment.