Commit f09eacca authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-5.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup fix from Tejun Heo:
 "This is a high priority but low risk fix for a cgroup1 bug where
  rename(2) can change a cgroup's name to something which can break
  parsing of /proc/PID/cgroup"

* 'for-5.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  cgroup1: don't allow '\n' in renaming
parents 29a877d5 b7e24eb1
...@@ -820,6 +820,10 @@ static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent ...@@ -820,6 +820,10 @@ static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent
struct cgroup *cgrp = kn->priv; struct cgroup *cgrp = kn->priv;
int ret; int ret;
/* do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable */
if (strchr(new_name_str, '\n'))
return -EINVAL;
if (kernfs_type(kn) != KERNFS_DIR) if (kernfs_type(kn) != KERNFS_DIR)
return -ENOTDIR; return -ENOTDIR;
if (kn->parent != new_parent) if (kn->parent != new_parent)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment