Commit 712317a
cgroup: fix broken file xattrs
We should store file xattrs in struct cfent instead of struct cftype,
because cftype is a type while cfent is object instance of cftype.
For example each cgroup has a tasks file, and each tasks file is
associated with a uniq cfent, but all those files share the same
struct cftype.
Alexey Kodanev reported a crash, which can be reproduced:
# mount -t cgroup -o xattr /sys/fs/cgroup
# mkdir /sys/fs/cgroup/test
# setfattr -n trusted.value -v test_value /sys/fs/cgroup/tasks
# rmdir /sys/fs/cgroup/test
# umount /sys/fs/cgroup
oops!
In this case, simple_xattrs_free() will free the same struct simple_xattrs
twice.
tj: Dropped unused local variable @cft from cgroup_diput().
Cc: <stable@vger.kernel.org> # 3.8.x
Reported-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>1 parent e57d5cf commit 712317a
2 files changed
Lines changed: 6 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | 425 | | |
429 | 426 | | |
430 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| |||
882 | 885 | | |
883 | 886 | | |
884 | 887 | | |
885 | | - | |
886 | 888 | | |
887 | 889 | | |
888 | 890 | | |
889 | 891 | | |
| 892 | + | |
890 | 893 | | |
891 | | - | |
892 | 894 | | |
893 | 895 | | |
894 | 896 | | |
| |||
2501 | 2503 | | |
2502 | 2504 | | |
2503 | 2505 | | |
2504 | | - | |
| 2506 | + | |
2505 | 2507 | | |
2506 | 2508 | | |
2507 | 2509 | | |
| |||
2677 | 2679 | | |
2678 | 2680 | | |
2679 | 2681 | | |
2680 | | - | |
2681 | | - | |
2682 | 2682 | | |
2683 | 2683 | | |
2684 | 2684 | | |
| |||
2703 | 2703 | | |
2704 | 2704 | | |
2705 | 2705 | | |
| 2706 | + | |
2706 | 2707 | | |
2707 | 2708 | | |
2708 | 2709 | | |
| |||
0 commit comments