]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
cgroup: fix broken file xattrs
authorLi Zefan <lizefan@huawei.com>
Fri, 19 Apr 2013 06:09:52 +0000 (23:09 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2013 03:08:22 +0000 (20:08 -0700)
commitfdb2b6f6dfc7b5a1c741a677eb990070690958f7
tree1b2c2f5a8af166416387ee346b54f8b370d1f423
parent1ef527a1111b2a206d39d2e23cf13819e329f8b4
cgroup: fix broken file xattrs

commit 712317ad97f41e738e1a19aa0a6392a78a84094e upstream.

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().

Reported-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/cgroup.h
kernel/cgroup.c