summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAlban Crequy <alban.crequy@collabora.co.uk>2014-08-18 15:20:20 +0400
committerTejun Heo <tj@kernel.org>2014-08-18 18:18:57 +0400
commit71b1fb5c4473a5b1e601d41b109bdfe001ec82e0 (patch)
tree6116b623ff191046a53f6a93906f17d7e9d4afec /kernel
parent7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff)
downloadlinux-71b1fb5c4473a5b1e601d41b109bdfe001ec82e0.tar.xz
cgroup: reject cgroup names with '\n'
/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: Alban Crequy <alban.crequy@collabora.co.uk> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 7dc8788cfd52..c3d1802a9b30 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/<pid>/cgroup unparsable.
+ */
+ if (strchr(name, '\n'))
+ return -EINVAL;
+
parent = cgroup_kn_lock_live(parent_kn);
if (!parent)
return -ENODEV;