cgroup: fix an off-by-one bug which may trigger BUG_ON()
commitf596ca6c42fc4a8bb8269684ad2b839d78f684eb
authorLi Zefan <lizefan@huawei.com>
Tue, 12 Mar 2013 22:36:00 +0000 (12 15:36 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 13 May 2013 14:02:11 +0000 (13 15:02 +0100)
tree737fd5ca927a75c79ee33d35e87490c86433ee8c
parent6d895982c8155fca39e857dd9777171e4747d4da
cgroup: fix an off-by-one bug which may trigger BUG_ON()

commit 3ac1707a13a3da9cfc8f242a15b2fae6df2c5f88 upstream.

The 3rd parameter of flex_array_prealloc() is the number of elements,
not the index of the last element.

The effect of the bug is, when opening cgroup.procs, a flex array will
be allocated and all elements of the array is allocated with
GFP_KERNEL flag, but the last one is GFP_ATOMIC, and if we fail to
allocate memory for it, it'll trigger a BUG_ON().

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
kernel/cgroup.c