summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAlban Crequy2014-08-18 13:20:20 +0200
committerTejun Heo2014-08-18 16:18:57 +0200
commit71b1fb5c4473a5b1e601d41b109bdfe001ec82e0 (patch)
tree6116b623ff191046a53f6a93906f17d7e9d4afec /kernel
parentLinux 3.17-rc1 (diff)
downloadkernel-qcow2-linux-71b1fb5c4473a5b1e601d41b109bdfe001ec82e0.tar.gz
kernel-qcow2-linux-71b1fb5c4473a5b1e601d41b109bdfe001ec82e0.tar.xz
kernel-qcow2-linux-71b1fb5c4473a5b1e601d41b109bdfe001ec82e0.zip
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;