cgroups: fix to return errno in a failure path
authorLi Zefan <lizf@cn.fujitsu.com>
Tue, 2 Feb 2010 21:44:10 +0000 (13:44 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Feb 2010 02:11:22 +0000 (18:11 -0800)
commit4528fd0595847c2078b59f24800e751c2d6b7e41
tree0be4aca79bc9b6709d4762f43ae53e2589931a85
parentef2b9b054580ef835078d8aa411bd06542cd5c1c
cgroups: fix to return errno in a failure path

In cgroup_create(), if alloc_css_id() returns failure, the errno is not
propagated to userspace, so mkdir will fail silently.

To trigger this bug, we mount blkio (or memory subsystem), and create more
then 65534 cgroups.  (The number of cgroups is limited to 65535 if a
subsystem has use_id == 1)

 # mount -t cgroup -o blkio xxx /mnt
 # for ((i = 0; i < 65534; i++)); do mkdir /mnt/$i; done
 # mkdir /mnt/65534
 (should return ENOSPC)
 #

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: Paul Menage <menage@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/cgroup.c