Commit ac229fd9 authored by Alban Crequy's avatar Alban Crequy Committed by Kamal Mostafa

cgroup: reject cgroup names with '\n'

commit 71b1fb5c upstream.

/proc/<pid>/cgroup contains one cgroup path on each line. If cgroup names are
allowed to contain "\n", applications cannot parse /proc/<pid>/cgroup safely.
Signed-off-by: default avatarAlban Crequy <alban.crequy@collabora.co.uk>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
[ kamal: backport to 3.13-stable: fixed in cgroup_create() ]
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 4d230249
......@@ -4350,6 +4350,11 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
struct cgroup_subsys *ss;
struct super_block *sb = root->sb;
/* Do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable.
*/
if (strchr(dentry->d_name.name, '\n'))
return -EINVAL;
/* allocate the cgroup and its ID, 0 is reserved for the root */
cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
if (!cgrp)
......
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