cgroup: fix idr leak for the first cgroup root
authorJohannes Weiner <hannes@cmpxchg.org>
Fri, 17 Jun 2016 16:23:59 +0000 (12:23 -0400)
committerTejun Heo <tj@kernel.org>
Fri, 17 Jun 2016 18:16:28 +0000 (14:16 -0400)
commit8c8a5502183c724854afd2f143a72f7eb71b6fea
tree8d9c0a06d651b1b6429d8a4968570c0b0013115f
parentdb06d759d6cf903aeda8c107fd3abd366dd80200
cgroup: fix idr leak for the first cgroup root

The valid cgroup hierarchy ID range includes 0, so we can't filter for
positive numbers when freeing it, or it'll leak the first ID. No big
deal, just disruptive when reading the code.

The ID is freed during error handling and when the reference count
hits zero, so the double-free test is not necessary; remove it.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup.c