Skip to content
Commit d9c10ddd authored by Michal Hocko's avatar Michal Hocko Committed by Tejun Heo
Browse files

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: default avatarLi Zefan <lizefan@huawei.com>
Signed-off-by: default avatarMichal Hocko <mhocko@suse.cz>
Acked-by: default avatarGlauber Costa <glommer@parallels.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 1e2ccd1c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment