]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
cgroup: fix use-after-free when umounting cgroupfs
authorLi Zefan <lizefan@huawei.com>
Fri, 26 Apr 2013 18:58:02 +0000 (11:58 -0700)
committerTejun Heo <tj@kernel.org>
Fri, 26 Apr 2013 18:58:02 +0000 (11:58 -0700)
commitcc20e01cd607282d48f8ea538aba10fa850a4312
tree598ff80edab2c3bb3547dcd109e35ed1291f4454
parent712317ad97f41e738e1a19aa0a6392a78a84094e
cgroup: fix use-after-free when umounting cgroupfs

Try:
  # mount -t cgroup xxx /cgroup
  # mkdir /cgroup/sub && rmdir /cgroup/sub && umount /cgroup

And you might see this:

ida_remove called for id=1 which is not allocated.

It's because cgroup_kill_sb() is called to destroy root->cgroup_ida
and free cgrp->root before ida_simple_removed() is called. What's
worse is we're accessing cgrp->root while it has been freed.

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup.c