Re: [PATCH v4 6/6] memcg: avoid dangling reference count in creation failure.

Michal Hocko
2013-01-22T14:00:58Z

On Tue 22-01-13 17:47:41, Glauber Costa wrote:
> When use_hierarchy is enabled, we acquire an extra reference count
> in our parent during cgroup creation. We don't release it, though,
> if any failure exist in the creation process.
>
> Signed-off-by: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
> Reported-by: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>

Acked-by: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>

> ---
> mm/memcontrol.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 357324c..72a008e 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6166,6 +6166,8 @@ mem_cgroup_css_online(struct cgroup *cont)
> * call __mem_cgroup_free, so return directly
> */
> mem_cgroup_put(memcg);
> + if (parent->use_hierarchy)
> + mem_cgroup_put(parent);
> }
> return error;
> }
> --
> 1.8.1
>

--
Michal Hocko
SUSE Labs