Files
OrangePi_CM5/include/linux
Li Zefan 65dff759d2 cgroup: fix cgroup_path() vs rename() race
rename() will change dentry->d_name. The result of this race can
be worse than seeing partially rewritten name, but we might access
a stale pointer because rename() will re-allocate memory to hold
a longer name.

As accessing dentry->name must be protected by dentry->d_lock or
parent inode's i_mutex, while on the other hand cgroup-path() can
be called with some irq-safe spinlocks held, we can't generate
cgroup path using dentry->d_name.

Alternatively we make a copy of dentry->d_name and save it in
cgrp->name when a cgroup is created, and update cgrp->name at
rename().

v5: use flexible array instead of zero-size array.
v4: - allocate root_cgroup_name and all root_cgroup->name points to it.
    - add cgroup_name() wrapper.
v3: use kfree_rcu() instead of synchronize_rcu() in user-visible path.
v2: make cgrp->name RCU safe.

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2013-03-04 09:50:08 -08:00
..
…
2013-03-01 13:39:00 -08:00
…
2013-02-22 09:22:19 +02:00
2013-01-02 17:36:10 -08:00
…
…
…
…
…
…
…
2013-01-03 14:34:06 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2013-02-25 09:24:55 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2012-12-24 09:36:38 -07:00
2013-02-21 14:16:27 -03:00
…
…
…
…
2013-02-26 02:46:08 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
2013-01-24 09:04:04 +01:00
…
…
…
…
…
…
…
…
…
2013-02-22 23:31:31 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2013-01-25 21:03:54 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
2013-02-27 19:10:21 -08:00
…
…
…
…
…
2013-02-06 15:59:47 -05:00
…
…
…
2012-12-14 13:05:26 +10:30
…
…
2013-01-29 13:59:57 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
2013-01-10 11:44:38 -06:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2013-01-29 19:32:58 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2012-12-12 17:38:33 -08:00
…
…
…
…
…
…
2013-01-21 17:18:20 +10:30
2012-12-14 13:06:40 +10:30
…
…
…
…
…
…
…
…
…
…
2012-12-25 18:45:06 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2013-01-24 15:37:26 +01:00
…
2013-01-03 15:57:14 -08:00
…
…
…
2013-01-23 13:44:00 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2013-02-19 08:43:34 +01:00
…
…
…
…
…
…
…
…
2013-02-03 15:09:26 -05:00
…
2012-12-18 15:02:13 -08:00
2012-12-18 15:02:14 -08:00
…
…
…
…
2013-02-10 19:41:08 -05:00
…
…
…
…
…
…
…
…
2012-12-24 09:36:38 -07:00
…
…
…
…
…
2013-02-14 09:21:15 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2013-01-15 22:43:15 -08:00
…
…
…
…
…
…
…
2013-02-08 18:28:04 +01:00
2013-01-25 15:06:01 -08:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…