Skip to content

Commit fa3d493

Browse files
committed
Merge tag 'selinux-pr-20190312' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fixes from Paul Moore: "Two small fixes for SELinux in v5.1: one adds a buffer length check to the SELinux SCTP code, the other ensures that the SELinux labeling for a NFS mount is not disabled if the filesystem is mounted twice" * tag 'selinux-pr-20190312' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: security/selinux: fix SECURITY_LSM_NATIVE_LABELS on reused superblock selinux: add the missing walk_size + len check in selinux_sctp_bind_connect
2 parents 8636b1d + 3815a24 commit fa3d493

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

security/selinux/hooks.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,8 +939,11 @@ static int selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
939939
BUG_ON(!(oldsbsec->flags & SE_SBINITIALIZED));
940940

941941
/* if fs is reusing a sb, make sure that the contexts match */
942-
if (newsbsec->flags & SE_SBINITIALIZED)
942+
if (newsbsec->flags & SE_SBINITIALIZED) {
943+
if ((kern_flags & SECURITY_LSM_NATIVE_LABELS) && !set_context)
944+
*set_kern_flags |= SECURITY_LSM_NATIVE_LABELS;
943945
return selinux_cmp_sb_context(oldsb, newsb);
946+
}
944947

945948
mutex_lock(&newsbsec->lock);
946949

@@ -5134,6 +5137,9 @@ static int selinux_sctp_bind_connect(struct sock *sk, int optname,
51345137
return -EINVAL;
51355138
}
51365139

5140+
if (walk_size + len > addrlen)
5141+
return -EINVAL;
5142+
51375143
err = -EINVAL;
51385144
switch (optname) {
51395145
/* Bind checks */

0 commit comments

Comments
 (0)