linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reject '\n' in a cgroup name
@ 2008-01-24  5:20 YAMAMOTO Takashi
  2008-01-28  7:49 ` Paul Menage
  0 siblings, 1 reply; 3+ messages in thread
From: YAMAMOTO Takashi @ 2008-01-24  5:20 UTC (permalink / raw)
  To: containers; +Cc: linux-mm

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@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;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-30  1:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24  5:20 [PATCH] reject '\n' in a cgroup name YAMAMOTO Takashi
2008-01-28  7:49 ` Paul Menage
2008-01-30  1:32   ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).