Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
[firefly-linux-kernel-4.4.55.git] / security / selinux / hooks.c
index d0cfaa9f19d08034a3c3600d8381ed166a369388..7c22a15c7e4b125a2a95ca75118bf0303068365a 100644 (file)
@@ -464,6 +464,13 @@ static int sb_finish_set_opts(struct super_block *sb)
        if (selinux_is_sblabel_mnt(sb))
                sbsec->flags |= SBLABEL_MNT;
 
+       /*
+        * Special handling for rootfs. Is genfs but supports
+        * setting SELinux context on in-core inodes.
+        */
+       if (strncmp(sb->s_type->name, "rootfs", sizeof("rootfs")) == 0)
+               sbsec->flags |= SBLABEL_MNT;
+
        /* Initialize the root inode. */
        rc = inode_doinit_with_dentry(root_inode, root);