diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 7dc8788cfd52dd222856057840a8d0a45a19816e..c3d1802a9b30c0f7a58a30d564315fefb7327fc8 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4543,6 +4543,11 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, struct cftype *base_files; int ssid, ret; + /* Do not accept '\n' to prevent making /proc//cgroup unparsable. + */ + if (strchr(name, '\n')) + return -EINVAL; + parent = cgroup_kn_lock_live(parent_kn); if (!parent) return -ENODEV;