aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/cgroup.h2
-rw-r--r--kernel/cgroup.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 17604767adfd..f97522790682 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -270,6 +270,8 @@ enum {
270 * - "release_agent" and "notify_on_release" are removed. 270 * - "release_agent" and "notify_on_release" are removed.
271 * Replacement notification mechanism will be implemented. 271 * Replacement notification mechanism will be implemented.
272 * 272 *
273 * - rename(2) is disallowed.
274 *
273 * - memcg: use_hierarchy is on by default and the cgroup file for 275 * - memcg: use_hierarchy is on by default and the cgroup file for
274 * the flag is not created. 276 * the flag is not created.
275 */ 277 */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 2e9da7bf25cb..c2c64005bbc2 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2508,6 +2508,13 @@ static int cgroup_rename(struct inode *old_dir, struct dentry *old_dentry,
2508 2508
2509 cgrp = __d_cgrp(old_dentry); 2509 cgrp = __d_cgrp(old_dentry);
2510 2510
2511 /*
2512 * This isn't a proper migration and its usefulness is very
2513 * limited. Disallow if sane_behavior.
2514 */
2515 if (cgroup_sane_behavior(cgrp))
2516 return -EPERM;
2517
2511 name = cgroup_alloc_name(new_dentry); 2518 name = cgroup_alloc_name(new_dentry);
2512 if (!name) 2519 if (!name)
2513 return -ENOMEM; 2520 return -ENOMEM;