Merge tag 'wireless-drivers-for-davem-2019-03-19' of git://git.kernel.org/pub/scm...
[linux-2.6-microblaze.git] / security / selinux / hooks.c
index c5363f0..1d0b37a 100644 (file)
@@ -939,8 +939,11 @@ static int selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
        BUG_ON(!(oldsbsec->flags & SE_SBINITIALIZED));
 
        /* if fs is reusing a sb, make sure that the contexts match */
-       if (newsbsec->flags & SE_SBINITIALIZED)
+       if (newsbsec->flags & SE_SBINITIALIZED) {
+               if ((kern_flags & SECURITY_LSM_NATIVE_LABELS) && !set_context)
+                       *set_kern_flags |= SECURITY_LSM_NATIVE_LABELS;
                return selinux_cmp_sb_context(oldsb, newsb);
+       }
 
        mutex_lock(&newsbsec->lock);
 
@@ -5134,6 +5137,9 @@ static int selinux_sctp_bind_connect(struct sock *sk, int optname,
                        return -EINVAL;
                }
 
+               if (walk_size + len > addrlen)
+                       return -EINVAL;
+
                err = -EINVAL;
                switch (optname) {
                /* Bind checks */