]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/namespace.c
mount: Don't allow copying MNT_UNBINDABLE|MNT_LOCKED mounts
[mirror_ubuntu-bionic-kernel.git] / fs / namespace.c
index dcf107925150aebf02185dc03c0a800a3719fd8c..91a3040f0cd0708b5cdfff22aac30cfcbe85dafa 100644 (file)
@@ -1798,8 +1798,14 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
                for (s = r; s; s = next_mnt(s, r)) {
                        if (!(flag & CL_COPY_UNBINDABLE) &&
                            IS_MNT_UNBINDABLE(s)) {
-                               s = skip_mnt_tree(s);
-                               continue;
+                               if (s->mnt.mnt_flags & MNT_LOCKED) {
+                                       /* Both unbindable and locked. */
+                                       q = ERR_PTR(-EPERM);
+                                       goto out;
+                               } else {
+                                       s = skip_mnt_tree(s);
+                                       continue;
+                               }
                        }
                        if (!(flag & CL_COPY_MNT_NS_FILE) &&
                            is_mnt_ns_file(s->mnt.mnt_root)) {