Skip to content

Commit f09eacc

Browse files
committed
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
2 parents 29a877d + b7e24eb commit f09eacc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/cgroup/cgroup-v1.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,10 @@ static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent
820820
struct cgroup *cgrp = kn->priv;
821821
int ret;
822822

823+
/* do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable */
824+
if (strchr(new_name_str, '\n'))
825+
return -EINVAL;
826+
823827
if (kernfs_type(kn) != KERNFS_DIR)
824828
return -ENOTDIR;
825829
if (kn->parent != new_parent)

0 commit comments

Comments
 (0)