[Devel] [PATCH] reject '\n' in a cgroup name

YAMAMOTO Takashi yamamoto at valinux.co.jp
Wed Jan 23 21:20:49 PST 2008


hi,

the following patch rejects '\n' in a cgroup name.
otherwise /proc/$$/cgroup is not parsable.

example:
	imawoto% cat /proc/$$/cgroup
	memory:/
	imawoto% mkdir -p "
	memory:/foo"
	imawoto% echo $$ >| "
	memory:/foo/tasks"
	imawoto% cat /proc/$$/cgroup
	memory:/
	memory:/foo
	imawoto% 

YAMAMOTO Takashi


Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
---

--- linux-2.6.24-rc8-mm1/kernel/cgroup.c.BACKUP	2008-01-23 14:43:29.000000000 +0900
+++ linux-2.6.24-rc8-mm1/kernel/cgroup.c	2008-01-24 13:56:28.000000000 +0900
@@ -2216,6 +2216,10 @@ static long cgroup_create(struct cgroup 
 	struct cgroup_subsys *ss;
 	struct super_block *sb = root->sb;
 
+	/* reject a newline.  otherwise /proc/$$/cgroup is not parsable. */
+	if (strchr(dentry->d_name.name, '\n'))
+		return -EINVAL;
+
 	cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
 	if (!cgrp)
 		return -ENOMEM;
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list