memcg: fix memcg_cache_name() to use cgroup_name()
authorMichal Hocko <mhocko@suse.cz>
Thu, 28 Mar 2013 07:48:14 +0000 (08:48 +0100)
committerTejun Heo <tj@kernel.org>
Sun, 7 Apr 2013 16:28:23 +0000 (09:28 -0700)
commitd9c10ddddc98db0a316243cd266c466875975a94
tree534cfc1a15c32047b07d7879c0b4a87a5d2095fd
parent1e2ccd1c0f67c3f958d6139de2496787b9a57182
memcg: fix memcg_cache_name() to use cgroup_name()

As cgroup supports rename, it's unsafe to dereference dentry->d_name
without proper vfs locks. Fix this by using cgroup_name() rather than
dentry directly.

Also open code memcg_cache_name because it is called only from
kmem_cache_dup which frees the returned name right after
kmem_cache_create_memcg makes a copy of it. Such a short-lived
allocation doesn't make too much sense. So replace it by a static
buffer as kmem_cache_dup is called with memcg_cache_mutex.

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Glauber Costa <glommer@parallels.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
mm/memcontrol.c