diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index d2488821cbd553efbd8cd74cf149e5154fd72fc3..cba19b8c3e5130683b359d2cb6a4ada77a30ca08 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1056,8 +1056,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);